Spaces:
Build error
Build error
| import gradio as gr | |
| def respond(message, history): | |
| """ | |
| Simple chatbot response function. | |
| Args: | |
| message (str): User's message | |
| history (list): Chat history | |
| Returns: | |
| str: Bot's response | |
| """ | |
| # Simple response dictionary | |
| responses = { | |
| "hello": "Hi there! How can I help you?", | |
| "hi": "Hello! Nice to meet you!", | |
| "how are you": "I'm doing great, thanks for asking!", | |
| "bye": "Goodbye! Have a great day!", | |
| "thank you": "You're welcome!", | |
| } | |
| # Check for matching response | |
| message = message.lower().strip() | |
| for key in responses: | |
| if key in message: | |
| return responses[key] | |
| # Default response if no match found | |
| return "I'm not sure I understand. Could you rephrase that?" | |
| # Create the chat interface | |
| demo = gr.ChatInterface( | |
| fn=respond, | |
| title="Simple test Chat bot", | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |