Gradio iframe embedding

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:

3 Likes