File size: 644 Bytes
4aa95b9
 
 
 
 
 
e3a37e1
4aa95b9
 
4f0476c
 
 
4aa95b9
 
 
 
 
 
 
 
 
 
 
 
 
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

import gradio as gr
import random
import time

with gr.Blocks() as demo:
    chatbot = gr.Chatbot(label="test-perf-pr")
    msg = gr.Textbox()
    clear = gr.ClearButton([msg, chatbot])
    
    for i in range(2000):
        gr.Button("hi", visible=False)

    def respond(message, chat_history):
        bot_message = "How are you?" * 10000
        chat_history.append((message, bot_message))
        for i in range(2000):
            chat_history[-1] = (chat_history[-1][0], chat_history[-1][1] + " " + str(i))
            yield "", chat_history

        print("done")

    msg.submit(respond, [msg, chatbot], [msg, chatbot])

demo.launch()