Open liuyixi520 opened 2 years ago
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)
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)
thank you very much, my problem has been solved by your advice. and when you fix this bug in your new version, can you give me a message, so i can use gradio3 in my work
That's strange. Will take a look.
Related to fonts: #1224
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).
What help is needed with this?
Besides fonts, there are several places in the code where contact via https is attempted to gradio.app
.
$ grep -RnF 'gradio.app'
documentation.py:18: documentation at www.gradio.app/docs.
networking.py:29:GRADIO_API_SERVER = "https://api.gradio.app/v1/tunnel-request"
strings.py:5:MESSAGING_API_ENDPOINT = "https://api.gradio.app/gradio-messaging/en"
utils.py:46:analytics_url = "https://api.gradio.app/"
utils.py:47:PKG_VERSION_URL = "https://api.gradio.app/pkg-version"
templates/cdn/index.html:11: <meta property="og:url" content="https://gradio.app/" />
templates/cdn/assets/index.8da6a09f.js:6197: attr(a, "href", "https://gradio.app");
templates/frontend/index.html:11: <meta property="og:url" content="https://gradio.app/" />
templates/frontend/share.html:11: <meta property="og:url" content="https://gradio.app/" />
templates/frontend/assets/index.4ddf74a5.js:6197: attr(a, "href", "https://gradio.app");
This also breaks when offline, with the exception of MESSAGING_API_ENDPOINT
, which has a fallback provision to use hardcoded defaults.
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
.
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 yourgr.Interface
/gr.TabbedInterface
.
Do we know what sort of data is being mined by analytics?
@abidlabs I want to deploy a chatbot on my local machine without internet connection for many users. However, when I use gradio==2.9.4, it does not contain the class gr.chatbot. When I use 3.24.1, it requires internet connection. Do you have any suggestion on this? I am not familiar with UI.
Hi @Juenjie unfortunately I do not think it is possible to use gr.Chatbot
right now without Internet connection. The gr.Chatbot
component was introduced in 3.x and, as you mentioned, 3.x currently does require Internet connection, mostly to fetch frontend assets.
@abidlabs For version 3.24.1, which is the one used for https://github.com/oobabooga/text-generation-webui/
, the reasons are as mentioned: the frontend resources. I came up with a quick hack which makes it work offline, so I don't know the ramifications of the changes, as my goal was to almost blindly remove remote references. I don't know whether this has been fixed in newer versions, or if it will be useful or not, but I attached the files with the changes made, it might be helpful to pinpoint the exact lines of code that should be reworked. Related issue: https://github.com/oobabooga/text-generation-webui/issues/867
Happy Bugiversary. Are the plans to resolve this year-old issue?
https://github.com/gradio-app/gradio/pull/4398 should fix offline for most use cases
My Gradio app want to load some javascript file from Amazon which it fails on my server (my server and my client don't have access to the internet). What should I do?
Url of the file: https://gradio.s3-us-west-2.amazonaws.com/3.39.0/assets/index-fda37c89.js
.
Is there any way to make this file available offline?
Update: I've found mutliple places where amazonaws is used (+).
I'm encountering this exact issue in gradio 3.44.4
Is there an earlier 3.x version which supports offline usage?
Do you have an example app showing this behaviour? The CDN should only be used when embedding gradio apps, for local apps it should be pulling the files from your local file system.
Update: I've found mutliple places where amazonaws is used
This is just the Gradio website and doesn't affect the Gradio library.
analytics_enabled=False
This works! My Gradio version is 4.19.2
@xinqingguo did you set the env variable os.environ["GRADIO_ANALYTICS_ENABLED"] = "False" or some parameter ?
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).
Same here. the fonts loading from the google fonts and the iframe resizer loading from cloudflare are the blockers.
This could be good for 5.0 @aliabid94
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.
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?
Reproduction
import gradio as gr
def greet(name): return "Hello " + name + "!!"
gr.Interface(fn=greet, inputs="text", outputs="text").launch(debug=True)
Screenshot
Logs
System Info
Severity
blocking all usage of gradio