gradio: Gradio Interface does not run locally without internet connection

Describe the bug

I am in a offline environment, that can not connect the internet. I see nothing in my browser when following ‘Quick Start’ section of the readme.

  1. use conda Create environment with python 3.7: conda create -n gradio3 python=3.7
  2. install gradio: pip install gradio Run the example script In the browser (Chrome and Edge tested) I see nothing. There errors in the console logs that say: https://fonts.googleapis.com/css?family=Source Sans Pro net::ERR_NAME_NOT_RESOLVED

can anyone give me a hlep to slove this problem, thanks very much. I am in a hurry

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

import gradio as gr

def greet(name): return "Hello " + name + “!!”

gr.Interface(fn=greet, inputs=“text”, outputs=“text”).launch(debug=True)

Screenshot

2125392789

Logs

Running on local URL:  http://127.0.0.1:7860/

To create a public link, set `share=True` in `launch()`.

System Info

Gradio: 3.0.10
Python: 3.7.0
OS: Windows 7
Browsers: Chrome 70.0.3538.110

Severity

blocking all usage of gradio

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 22
  • Comments: 20 (7 by maintainers)

Most upvoted comments

We currently load fonts from the google fonts CDN, the iframe resizer from CDNJS and bokeh from the Bokeh CDN. All of these things will break when offline. We need to copy the source and self host, preferably along with other static assets on the CDN rather than on the server in order to fix these issues (we should be self hosting fonts for performance reasons but font are slightly more complex as the google CDN is quite clever, we need to ensure we only load the smallest subset we can get away with).

Another thing to note, analytics are on by default, which don’t work with no network.

If anyone else is having issues with this, you can add analytics_enabled=False when initialising your gr.Interface/gr.TabbedInterface.

Hmmm it looks like we are loading certain assets from the web for Gradio 3.0. We should fix that @aliabid94

In the meantime, perhaps you can try using an older version of gradio (say gradio==2.9.4 – I don’t think they require being online)

https://github.com/gradio-app/gradio/pull/4398 should fix offline for most use cases