Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when embedding gradio app within a fastapi app with web components #8154

Open
1 task done
peeter2 opened this issue Apr 27, 2024 · 3 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@peeter2
Copy link

peeter2 commented Apr 27, 2024

Describe the bug

I have mounted gradio app within a fastapi app, and trying to embed it with web components, then I get an error

Could not load this space.
Please contact the author of the page to let them know.

I was trying to embed it like this:

<script
	type="module"
	src="https://gradio.s3-us-west-2.amazonaws.com/4.28.3/gradio.js"
></script>

<gradio-app src="https://example.com"></gradio-app>

Any idea what's wrong? Is it not possible to embed it like that if my gradio app is mounted within another fastapi app?

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

<script type="module" src="https://gradio.s3-us-west-2.amazonaws.com/4.28.3/gradio.js" ></script>

Screenshot

No response

Logs

No response

System Info

latest

Severity

I can work around it

@peeter2 peeter2 added the bug Something isn't working label Apr 27, 2024
@nyimbi
Copy link

nyimbi commented Apr 30, 2024

wget https://gradio.s3-us-west-2.amazonaws.com/4.28.3/gradio.js
Results in:
wget: unable to resolve host address ‘gradio.s3-west-2.amazonaws.com’

@flacomalone
Copy link

flacomalone commented May 2, 2024

I dont know if it is related to this issue, but I have the same problem in my own server while embedding the grad app. In my setup, the gradio app is running on its own server under (using a self signed certuificate for SSL). The code is basically the same. I found out that the issue disappeared when I accessed the original gradio app server at least once and then I accessed again the server hosting the embedded gradio app. It worked !

I decided to remove the SSL in the original gradio app, but now this trick doesn't work either...

@peeter2
Copy link
Author

peeter2 commented May 4, 2024

My gradio app is mounted to this url: http://127.0.0.1:7860/gradio

And I am trying to embed it like this

<script
	type="module"
	src="https://gradio.s3-us-west-2.amazonaws.com/4.19.1/gradio.js"
></script>
<gradio-app src="http://127.0.0.1:7860/gradio"></gradio-app>

But I am getting errors on browser console:

image

Looks like it is trying to access the config in the wrong url: http://127.0.0.1:7860/config
The correct url is http://127.0.0.1:7860/gradio/config

How to resolve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants