| # This is a simple Gradio app that creates a chat interface with a random response function. | |
| import random | |
| import gradio as gr | |
| # Define a function that takes a message and history, and returns a random response. | |
| def random_response(message, history): | |
| return random.choice(["Yes", "No"]) | |
| # Create a Gradio ChatInterface that uses the random_response function. | |
| demo = gr.ChatInterface(random_response, type="messages") | |
| # Launch the interface. | |
| if __name__ == "__main__": | |
| demo.launch(show_error=True) |