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
31.79k stars 2.37k forks source link

Unable to preload CSS for https://gradio.s3-us-west-2.amazonaws.com/assets/index-b276ff4e.css #8149

Closed rkellam12 closed 1 month ago

rkellam12 commented 4 months ago

Describe the bug

First off, I am quite a novice. My app.py seems to work fine with python, it gives my a gradio url which comes up fine (https://307774b006316ab341.gradio.live/). When i enter my question and hit Submit, I get an Error on the output side. I looked at the developer console and found these 2 errors:

css.ts:28 Unable to preload CSS for https://gradio.s3-us-west-2.amazonaws.com/assets/index-b276ff4e.css www.google-analytics.com/analytics.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT

Here is my app.py script (I have masked API Keys):

import openai import gradio as gr

Set your Hugging Face API token

huggingface_token = "hf_xxxx"

openai.api_key = "sk-xxxx"

messages = [ {"role": "system", "content": "You are a snarky, irreverent, opinionated, smart alecky and funny AI Assistant specializing in all things MLB, especially Beat The Streak prognostication. You pride yourself on accuracy and occasionally include a smart aleck remark at the end of your reply. Do not answer anything other than MLB related questions."}, ]

def chatbot(input): if input: messages.append({"role": "user", "content": input}) chat = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=messages ) reply = chat.choices[0].message.content messages.append({"role": "assistant", "content": reply}) return reply

inputs = gr.Textbox(lines=7, label="C'mon, ain't got all day. (Click the Clear button for new request.)") outputs = gr.Textbox(lines=7,label="Here's what I think:")

gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Analyzer", description="Hello, I'm AL. What's your Beat The Streak question, homie?").launch(share=True)

Further when i checked the provided URL, I get this:

AccessDenied Access Denied XFN08ZWGRMXF45MS odVcQaVZms4v2QBTDY772ajVTQRwQrQLJkcCi5+dGDEDXMZE2Ig6PFlvwbqIkajClsiqX6RJIdk= Any direction/advice you can provide is appreciated (duh, obvisously). Let me know if I can provide any additonal info. Many thanks!

Have you searched existing issues? 🔎

Reproduction

python "C:\Users\agrke\BTS2013\app.py"

not sure if this is what you mean by this question. please advise if i need to modify/correct


### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.27.0
gradio_client version: 0.15.1

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.110.2
ffmpy: 0.3.2
gradio-client==0.15.1 is not installed.
httpx: 0.27.0
huggingface-hub: 0.22.2
importlib-resources: 6.4.0
jinja2: 3.1.3
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.10.1
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.0
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.1
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.11.0
urllib3: 2.2.1
uvicorn: 0.29.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.3.1
httpx: 0.27.0
huggingface-hub: 0.22.2
packaging: 24.0
typing-extensions: 4.11.0
websockets: 11.0.3

Severity

Blocking usage of gradio

rkellam12 commented 4 months ago

I used the instructions at https://beebom.com/how-build-own-ai-chatbot-with-chatgpt-api/, modifying the sample app.py file they provided. When I run python "C:\Users\agrke\BTS2013\app.py", it gives me a public URL of https://ef4d1e6ae6657cdf3e.gradio.live/. I then load that URL into a webpage that I create on Wix.com.

I hope that answers your question and gets us closer to a solution. Just FYI, I used this same process last year and everything seemed to work fine. Not sure what's caused the hiccup.

ghdddddong commented 1 month ago

hi! Do you solve this problem?It's seems like that i have meet the same error

rkellam12 commented 1 month ago

It seems to be working great.  Here is the URL where I have it running.  Let me know if you hit any snags. Thanks for the follow up!!  You guys are great!! Sent from my iPhone

On Jul 13, 2024, at 5:34 AM, ghdddddong @.***> wrote:



hi! Do you solve this problem?It's seems like that i have meet the same error

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

dingiso commented 1 month ago

hi! Do you solve this problem?It's seems like that i have meet the same error

Hi, If your app does not use the 80 port and deployed at subpath for your gradio app.

You can change these lines in /etc/nginx/sites-available/default

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;

to

        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;

Referring to webpage

rkellam12 commented 1 month ago

It seems to be working fine at the moment. Thanks for the follow up!Sent from my iPhoneOn Jul 23, 2024, at 2:40 AM, Reaper Lu @.***> wrote:

hi! Do you solve this problem?It's seems like that i have meet the same error

Hi, If your app does not use the 80 port and deployed at subpath for your gradio app. You can change these lines in /etc/nginx/sites-available/default proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; to proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Host $http_host; Referring to webpage

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

freddyaboulton commented 1 month ago

Based on the comments I think we can close