Spaces:
Sleeping
Sleeping
import gradio as gr | |
import fastapi | |
def echo(request: gr.Request): | |
return request.headers, request.client.host | |
with gr.Blocks() as demo: | |
with gr.Column(): | |
with gr.Row(): | |
with_q = gr.Button(value="Print request with queue") | |
with gr.Row(): | |
with_q_headers = gr.JSON() | |
with_q_host = gr.Textbox() | |
with gr.Column(): | |
with gr.Row(): | |
without_q = gr.Button(value="print request without queue") | |
with gr.Row(): | |
without_q_headers = gr.JSON() | |
without_q_host = gr.Textbox() | |
with_q.click(echo, inputs=None, outputs=[with_q_headers, with_q_host], queue=True) | |
without_q.click(echo, inputs=None, outputs=[without_q_headers, without_q_host], queue=False) | |
demo.queue().launch() | |