Spaces:
Running
Running
jsrepo742
PR/2: updates simple chatbot sample code to run with Gradio 6.x (tested with Gradio 6.16 and 6.19). Updates files run.py and run.ipynb.
2ceaf12 Download run.py from gradio/chatbot_simple: direct link, hf CLI and curl.
- Browser
- Download file 582 Bytes
-
https://huggingface.co/spaces/gradio/chatbot_simple/resolve/refs%2Fpr%2F2/run.py
- Command line
-
hf download hf://spaces/gradio/chatbot_simple@refs/pr/2/run.py
-
curl -L -o run.py https://huggingface.co/spaces/gradio/chatbot_simple/resolve/refs%2Fpr%2F2/run.py
582 Bytes
| import gradio as gr | |
| import random | |
| import time | |
| def respond(message, chat_history): | |
| time.sleep(2) # simulate delay | |
| bot_message_text=random.choice(["How are you?", "Today is a great day", "I'm very hungry"]) | |
| return bot_message_text | |
| if __name__ == "__main__": | |
| demo = gr.ChatInterface( | |
| fn=respond, | |
| chatbot = gr.Chatbot(height=400, placeholder="Start chatting..."), | |
| textbox=gr.Textbox(placeholder="Type a message..."), | |
| title="Simple Gradio 6.x Chatbot", | |
| description="A random response chatbot." | |
| ) | |
| demo.launch(debug=True) | |