gradio/demo/concurrency_with_queue/run.py
Ömer Faruk Özdemir f66c104fc2
Max thread tweaks (#2038)
* max-thread-tweaks

1. move creation of limiter to fastapi endpoint since run_coro_in_background works only in there
2. make max_threads compatible with queue concurrency count

* max-thread-tweaks

1. add warning to run_coro_in_background
2022-08-19 16:28:52 -04:00

17 lines
273 B
Python

import gradio as gr
import time
def say_hello(name):
time.sleep(5)
return f"Hello {name}!"
with gr.Blocks() as demo:
inp = gr.Textbox()
outp = gr.Textbox()
button = gr.Button()
button.click(say_hello, inp, outp)
demo.queue(concurrency_count=41).launch()