When I use the mount_gradio_app() method, add the auth_dependency parameter, and start the fastapi service, I find that the send button submit event cannot take effect.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
from fastapi import FastAPI, Request
import gradio as gr
import uvicorn
app = FastAPI()
import re
def get_user(request: Request):
host = request.client.host
query = request.url.query
query = re.split('=|&',query)
new_dic = {'user':None}
for i in range(len(query)):
if i % 2 == 0 and len(query)>0:
try :new_dic[query[i]] = query[i+1]
except Exception as e:print(e)
print(new_dic)
if host=="127.0.0.1":
if new_dic['user'] == '52HZ':
return True
else:
return None
else:
return None
def chat(message,history):
return "Hello"
demo = gr.ChatInterface(fn=chat,)
demo.startup_events()
app = gr.mount_gradio_app(app, demo, path="/", auth_dependency=get_user)
if __name__ == '__main__':
uvicorn.run(app,port=8001)
Screenshot
No response
Logs
No response
System Info
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.28.3
gradio_client version: 0.16.0
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.110.2
ffmpy: 0.3.2
gradio-client==0.16.0 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.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.2
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
Describe the bug
When I use the mount_gradio_app() method, add the auth_dependency parameter, and start the fastapi service, I find that the send button submit event cannot take effect.
Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio