File size: 692 Bytes
0ad74ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
from time import sleep
version, _, _ = gr.__version__.split(".")
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
text = gr.Textbox()
time = gr.Number(label="Time to Complete")
def respond(text):
output = ["Lorem"] * 500
for i in range(len(output) + 1):
yield [[text, " ".join(output[:i])]]
sleep(0.01)
if version == "3":
text.submit(respond, text, chatbot)
else:
text.submit(respond, text, chatbot, concurrency_limit=None)
if __name__ == "__main__":
if version == "3":
demo.queue(concurrency_count=250).launch(max_threads=250)
else:
demo.launch(max_threads=250)
|