mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
bc786ae4da
* changes * first commit * Update gradio/upload.py Co-authored-by: Aarni Koskela <akx@iki.fi> * Update gradio/upload.py Co-authored-by: Aarni Koskela <akx@iki.fi> * changes * changes * changes * changes * changes * changes * changes * chnages * changes * changes * changes * changes * changes * changes * changes * changes * chagnes * changes * changes * changes * changes * changes * changes --------- Co-authored-by: Aarni Koskela <akx@iki.fi> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
21 lines
549 B
Python
21 lines
549 B
Python
import gradio as gr
|
|
import random
|
|
import time
|
|
|
|
with gr.Blocks() as demo:
|
|
chatbot = gr.Chatbot()
|
|
msg = gr.Textbox()
|
|
clear = gr.Button("Clear")
|
|
|
|
def respond(message, chat_history):
|
|
bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
|
|
chat_history.append((message, bot_message))
|
|
time.sleep(2)
|
|
return "", chat_history
|
|
|
|
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
clear.click(lambda: None, None, chatbot, queue=False)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|