Describe the bug
From @radames
I was happy to learn about mounting Gradio with Fast Api!! https://gradio.app/sharing_your_app/#mounting-within-another-fastapi-app
I’m trying to enable queue on a Block Interface with FastAPI serving static files, two things are happening:
first the websocket address has an extra slash via UI ws://127.0.0.1:8000/gradio//queue/join ( I guess it’s the frontend bug, due to the mounting path different than /)
I’m not sure it this is the right way to enable Queue before mounting FastAPI app? while I can connect and send and receive the estimation response I don’t get any final responses
Is there an existing issue for this?
Reproduction
First, you won't be able to launch the following app because the websocket endpoint will be incorrect. If you manually modify the frontend to fix the ws endpoint, you won't be to run a prediction on this app. That is because the thread that runs the queue is never started.
import gradio as gr
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
app = FastAPI()
block = gr.Blocks()
with block:
prompt = gr.Text()
gallery = gr.Gallery().style(grid=[2], height="auto")
contains_nfsw = gr.JSON(visible=False)
btn = gr.Button("Generate")
btn.click(dream, inputs=prompt, outputs=[gallery, contains_nfsw])
block.queue()
block.config['enable_queue'] = True
block.config['dev_mode'] = False
gradio_app = gr.routes.App.create_app(block)
app.mount("/gradio", gradio_app)
app.mount("/", StaticFiles(directory="static", html=True), name="static")
Screenshot
No response
Logs
System Info
Severity
serious, but I can work around it
Describe the bug
From @radames
Is there an existing issue for this?
Reproduction
First, you won't be able to launch the following app because the websocket endpoint will be incorrect. If you manually modify the frontend to fix the ws endpoint, you won't be to run a prediction on this app. That is because the thread that runs the queue is never started.
Screenshot
No response
Logs
System Info
Severity
serious, but I can work around it