Spaces:
Runtime error
Runtime error
Download Demo Basic.py from bumk766fall2023/ChatBot: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/spaces/bumk766fall2023/ChatBot/resolve/main/Demo%20Basic.py
- Command line
-
hf download 'hf://spaces/bumk766fall2023/ChatBot/Demo Basic.py'
-
curl -L -o 'Demo Basic.py' https://huggingface.co/spaces/bumk766fall2023/ChatBot/resolve/main/Demo%20Basic.py
1.43 kB
| import gradio as gr | |
| import random | |
| import time | |
| with gr.Blocks() as demo: | |
| chatbot = gr.Chatbot() | |
| msg = gr.Textbox() | |
| clear = gr.ClearButton([msg, chatbot]) | |
| def respond(message, chat_history): | |
| bot_message = random.choice(["I love you", "The clever word play makes this book a fun choice for story time. One day, a chimpanzee and a kinkajou take a walk, enjoying the buttercups, at least until the chimpanzee lets loose a gigantic sneeze; otherwise known as a chimpanSNEEZE. The sneeze sends the kinkajou flying off the page into the back of an elephant painting a fence. The rhyming text follows the disasters that occur as a result of the initiating sneeze. An elephant with paint on it's head and an extended trunk, trips a buffalo carrying bread, which leads to a disaster with mustard and a hippo. It seems nothing will fix the mess, until another mighty sneeze rights the ship. Or does it? The vivid illustrations showing all kinds of mayhem will hold the attention of the youngest listeners, while older children will appreciate unusually combined words such as Buffaloaf and Hippopotamustard. Not only a fun tale of nonsense but a perfect demonstration of the power of cause and effect. An enjoyable read for young and old."]) | |
| chat_history.append((message, bot_message)) | |
| time.sleep(2) | |
| return "", chat_history | |
| msg.submit(respond, [msg, chatbot], [msg, chatbot]) | |
| demo.launch() |