Spaces:
Sleeping
Sleeping
File size: 783 Bytes
b51c81c 62e2feb b51c81c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|