Spaces:
Running
Running
File size: 816 Bytes
db32e48 |
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 28 29 30 31 32 33 34 35 36 |
import time
import gradio as gr
import modelscope_studio as mgr
def submit(_chatbot):
_chatbot.append(["test user",
"test bot"]) # bot starts the typewriter by default
yield _chatbot
time.sleep(2)
_chatbot.append(["test user", {
"text": "test bot",
"flushing": False
}]) # both start the typewriter
yield _chatbot
time.sleep(2)
_chatbot.append([{
"text": "test user",
"flushing": True
}, {
"text": "test bot",
"flushing": False
}]) # user starts the typewriter
yield _chatbot
with gr.Blocks() as demo:
chatbot = mgr.Chatbot(height=600, )
button = gr.Button("Submit")
button.click(fn=submit, inputs=[chatbot], outputs=[chatbot])
if __name__ == "__main__":
demo.queue().launch()
|