gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
30.35k stars 2.26k forks source link

Interface not visible on Windows 10 (Chrome Browser) #700

Closed saratrajput closed 2 years ago

saratrajput commented 2 years ago

Describe the bug While testing a simple gradio app on Windows 10 with Chrome browser, the interface launches without error, but it is not visible either in the Jupyter Notebook or in the local URL.

To Reproduce Steps to reproduce the behavior:

  1. Open a Jupyter Lab session and run the following code:
import gradio as gr

def hello_world(name):
    return "Hello..." + name + "!!"

interface = gr.Interface(fn=hello_world, inputs='text', outputs="text")
interface.launch()

Screenshots

image

Device information (please complete the following information):

Additional context Add any other context about the problem here.

abidlabs commented 2 years ago

Can you try installing gradio==2.8.1 and see if you have the same issue?

pip install gradio==2.8.1

saratrajput commented 2 years ago

Yes, gradio==2.8.1 has the same issue as well. I tested with Firefox browser and it also has the same issue.

abidlabs commented 2 years ago

Can you open up the console log in the inspector and tell us what errors you see?

saratrajput commented 2 years ago

image image


1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/codeCellConfig"
1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/markdownCellConfig"
1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/rawCellConfig"
1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/codeCellConfig"
1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/markdownCellConfig"
1902.cebcb09d0dbbb83…cb09d0dbbb83ac5d2:2 $ref: keywords ignored in schema at path "#/properties/rawCellConfig"
jlab_core.0adf13f767…f13f7678b3af0da97:2 TypeError: Cannot read properties of undefined (reading 'widgets')
    at Object.p [as generate] (static/lab/jlab_core…b3af0da97:2:1108305)
    at ae.onUpdateRequest (static/lab/jlab_core…b3af0da97:2:1112280)
    at ae.e.processMessage (static/lab/jlab_core…b3af0da97:2:1439394)
    at b (static/lab/jlab_core…b3af0da97:2:1406135)
    at t (static/lab/jlab_core…b3af0da97:2:1404706)
    at y (static/lab/jlab_core…b3af0da97:2:1406390)
index.6e77b405.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
vendor.3e20f013.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/main.ce65c51….js.map?v=ce65c51…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/4151.fd7ca59….js.map?v=fd7ca59…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/911.0c08f04….js.map?v=0c08f04…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/6700.9bfbe77….js.map?v=9bfbe77…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/126.1e2fb99….js.map?v=1e2fb99…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1902.cebcb09….js.map?v=cebcb09…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/4155.784ca17….js.map?v=784ca17…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1033.890eeae….js.map?v=890eeae…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/4570.53adcb6….js.map?v=53adcb6…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/2719.e5ff90b….js.map?v=e5ff90b…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/7294.f71c288….js.map?v=f71c288…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1036.b407e23….js.map?v=b407e23…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/714.d38baae….js.map?v=d38baae…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/7084.cb32d66….js.map?v=cb32d66…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/7755.d506a1d….js.map?v=d506a1d…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/9473.ac8fe4a….js.map?v=ac8fe4a…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/9761.6a67038….js.map?v=6a67038…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1057.a060854….js.map?v=a060854…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/3935.4159b02….js.map?v=4159b02…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/3029.8636761….js.map?v=8636761…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/7024.d34685e….js.map?v=d34685e…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/4429.c4f083e….js.map?v=c4f083e…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1249.39ca2df….js.map?v=39ca2df…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/1358.9ab4f57….js.map?v=9ab4f57…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/3496.ecb0e7f….js.map?v=ecb0e7f…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/7796.d14a6b9….js.map?v=d14a6b9…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/3502.c915d99….js.map?v=c915d99…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/6080.39703b8….js.map?v=39703b8…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/4631.96a143e….js.map?v=96a143e…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/807.6a2e483….js.map?v=6a2e483…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for http://localhost:8888/static/lab/jlab_core.0adf13f….js.map?v=0adf13f…: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
```
saratrajput commented 2 years ago

Tried the first few solutions for the above error DevTools failed to load source map: Could not load content for, but it doesn't help.

CatChenal commented 2 years ago

@saratrajput It could be a jupyter lab issue. Have you tried on colab?

abidlabs commented 2 years ago

Hi @saratrajput were you able to figure this out? Unfortunately, despite our best efforts, we can't replicate this issue. Please let us know if you see the same issue on colab and if possible share the colab with us. Otherwise, we will need to close the issue since we can't reproduce it

AstraliteHeart commented 2 years ago

I've experienced the same issue and this comment seems to describe what is going on well https://bugs.python.org/issue43975, I can also confirm the registry fix works (but you may need to clear the cache).

abidlabs commented 2 years ago

Interesting, thanks @AstraliteHeart for the pointer! @saratrajput let us know if this fixes your issue or if there's anything else we can do to help.

I'm closing this for now -- but we can reopen if you have more information.

Kp2442 commented 2 years ago

Setting share = True fixed the problem for me.

nikky4D commented 2 years ago

Is there a fix for this as I am also getting this error with the first example on gradio's page.

With share=True, the error goes away. However, I would like to use a local address and not need a public one.

I cannot do the HKEY modification of the registry, but I was able to find a workaround for my jupyter notebook here: mimetype change It is temporary and only for my environment so will have to be done for every new environment I think.

KarimElsayad247 commented 2 years ago

The described in the forum post linked by @AstraliteHeart did work. I'll put it here in clear steps.

[Disclaimer] Modifying the registry improperly can result in Windows becoming corrupted. You should only attempt these directions if you have your data backed up and are willing to risk creating additional problems. You should also back up the Windows registry.

If you're not comfortable with modifying registry keys, you can also create a system restore point. Overall, be careful and don't modify the wrong keys.

Steps:

  1. Open the "registry editor" program. Search for "Registry Editor" using windows search, or use the shortcut "Windows key + r" and type "regedit" in the box that open.

  2. Navigate to the location Computer\HKEY_CLASSES_ROOT\.js

  3. You should see some registry keys. I had [.default, Content Type, Perceived Type]. under Data column, value for Content Type was text/plain

  4. Double click "Content Type" and change contents of "Value Data" to "application/javascript", and press ok image

  5. If your Gradio app is still running, make sure to shut it down, the reopen it.

  6. launch the gradio app. It should now be working.

datalifenyc commented 1 year ago

Setting share = True fixed the problem for me.

It's interesting that share = True resolves the local URL.

neilmahaseth commented 1 year ago

Incorrect Mime Type for javascript file being sent by gradio server on Windows 10. Adding share = True fixes it.

neilmahaseth commented 1 year ago

To reproduce it you can try installing it on Windows 10 Build Number 19044.1889 using miniconda environment installed using pip using gradio-3.1.7-py3-none-any.whl - python=3.8.5 - pip=20.3

Or you can simply try installing this fork of stable diffusion https://github.com/basujindal/stable-diffusion on Windows 10

Let me know if you need more information.

TropComplique commented 1 year ago

I have the same problem: gradio interface is not visible in a jupyter notebook. I run jupyterlab on a remote debian server and then use jupyterlab through safari browser.

I use jupyterlab==3.6.1 and gradio==3.19.1.

Adding share=True to launch fixes the problem. But I don't want to make my demos public.

abidlabs commented 1 year ago

Hi @TropComplique the basic reason this is happening is that when you run jupyter on a remote server, Gradio starts running on port 7860 (by default) on that remote server. However, you can't view it in your browser because that port has not been forwarded to your local machine. There are two solutions that I can think of:

TropComplique commented 1 year ago

Hi @abidlabs. Thank you for help. It works!

Using SSH with flag -L 7860:localhost:7860 fixes the problem.

abidlabs commented 1 year ago

Awesome, thanks for sharing the command.

jan-gerritsen commented 8 months ago

Changing 0.0.0.0 to localhost in generate.py worked for me

Woodytse commented 1 month ago

Hi @abidlabs. Thank you for help. It works!

Using SSH with flag -L 7860:localhost:7860 fixes the problem.

I have the same issue and I m not familiar with SSH. Could you please provide the step by step tutorial for solving this problem

Thank you very much