# Web component embed of Gradio app from HF Space

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237%3E%5C
**Category:** Spaces\
**Created:** [December 21, 2022, 4:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237 "2022-12-21T16:45:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiochiu](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/fabiochiu/32/13157_2.png) [@fabiochiu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffabiochiu)%5C
**Post date:** [December 21, 2022, 4:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237%2F1 "2022-12-21T16:45:50Z")

</div>

Hello!

I’m trying to embed a Gradio app that I deployed on an HF Space using Web components. The embed initially works fine, as I can see the Gradio app embedded on my website. However, when I’m on my website and try using the app to compute the sentiment of a sentence (using a model hosted on HF), the app raises the error “Connection errored out.” The app works fine if used directly from the HF Space, or if embedded using iframes.

Some additional info and investigating:

- The space can be found at “[https://fabiochiu-sentiment-analysis-demo.hf.space](https://fabiochiu-sentiment-analysis-demo.hf.space)”.
- I’ve noticed that upon using the model from the HF Space there happens a GET request at “wss://fabiochiu-sentiment-analysis-demo.hf.space/queue/join”. If I use the app from a Web component embed, the same GET request goes to “my-website-address/queue/join”, which raises an error. If I use the app from an iframe, that request goes to “wss://fabiochiu-sentiment-analysis-demo.hf.space/queue/join” and everything works fine.

Do you know why I may get this error?

Thanks!

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [December 22, 2022, 8:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237%2F2 "2022-12-22T20:45:34Z")

</div>

hi @fabiochiu, indeed you’re right, I think there is is bug when using the gradio web-component since the WSS endpoint should be to the original hf.space. You can report on [Issues · gradio-app/gradio · GitHub](https://github.com/gradio-app/gradio/issues) otherwise I can do that.

Meanwhile, you can use the iframe version

```auto
    <iframe
      src="https://fabiochiu-sentiment-analysis-demo.hf.space"
      frameborder="0"
      width="850"
      height="645"
    ></iframe>

```

Thanks

---

<div class="post-metadata">

**Author:** ![fabiochiu](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/fabiochiu/32/13157_2.png) [@fabiochiu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffabiochiu)%5C
**Post date:** [December 24, 2022, 4:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237%2F3 "2022-12-24T16:47:55Z")

</div>

Hi @radames, thanks for your answer. I’m opening an issue on the repo, I’ll use the iframe in the meanwhile.

Have a nice day!

---

<div class="post-metadata">

**Author:** ![Deadmon](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/deadmon/32/23381_2.png) [@Deadmon](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FDeadmon)%5C
**Post date:** [April 29, 2024, 3:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fweb-component-embed-of-gradio-app-from-hf-space%2F28237%2F4 "2024-04-29T15:40:27Z")

</div>

This hasn’t been fixed yet in 2 years?  
Please tell me the correct way to embed files with gradio app. You can’t manipulate the html with an iframe.
