Hi @luisoala, one of the developers of Gradio here. Thanks for your question - the Gradio website has some documentation on hosting on Spaces (Gradio), but we can definitely improve it.
i want to embed the demo in a website, in my case a project site “A”
to me, it was not obvious which url should be used for the iframe embed. after doing ctl+c on hf space i found “B” which is different from the default spaces url for the demo “C”. also, the first url provides some further fromatting options with “?_”, e.g. dark mode etc.
if there is documentation explaining how hf spaces are to embedded it could be linked in the “gradio+hf spaces” guide.
let me know if this was clear or further context is needed.
Yes you have great timing, since we actually just implemented this feature! You can now use native embeddings instead of iframes for a better experience and better UI. We’ll be announcing this shortly along with instructions, but in the meantime, you can take a look at our landing page where we have used the new native embeddings for all 4 of the demos: https://www.gradio.app/
We haven’t officially added docs yet, but unofficially, here’s how you do it
// import this in HTML file
<script defer="defer" id="gradio-library" src="www.gradio.app/gradio_static/bundle.js">
// in script tags:
launchGradioFromSpaces("path/to/spaces", "#div")
I find that clicking on an example image (image segmentation tab) for inference does not work on https://www.gradio.app/. Is there any way we can make it work?
FYI I found that I needed to pin my SDK version to before 3.0 on Hugging Face (e.g. 2.9.4) in order for embedding to work, even on an identical copy of the Space.
This was a tricky one to debug, because the SDK versions are not pinned on the example Spaces. I believe there’s implicit state here, where the SDK version is set when the Space is built, so cloning a Space is not enough to get the same behavior.
Didn’t fully root cause, but noticed that the “view the API” link doesn’t appear if you have gradio>2.9.4 and the associated endpoints, e.g. https://hf.space/embed/{entity}/{project}/api give 500 errors. Could be due to a cross-origin issue, based on error output below, but I’m out of my web dev depth here:
Hi, I’m looking for recommendations for website hosts that can handle ML app embeds like those for HF-Gradio.
I’ve been trying Squarespace for a bit, and can’t seem to get the embed right, even after taking up a “business” account that allows iframes and JS.
I don’t have web design skills so would rather use a host that has ready-made templates. Would folks who have successfully embedded their apps on their own website have any recommendations?