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 | 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) | |