Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PARAMS = {"name": "FriendlyBot"}
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import random
|
| 5 |
+
|
| 6 |
+
PARAMS = {} # Parameters will be injected by the Assembler
|
| 7 |
+
|
| 8 |
+
def chatbot_response(message, history):
|
| 9 |
+
# Simple rule-based responses\n if "hello" in message.lower():\n return "Hello! How can I assist you today?"\n elif "how are you" in message.lower():\n return "I'm doing great, thanks for asking! How about you?"\n elif "bye" in message.lower():\n return "Goodbye! Feel free to chat with me anytime."\n else:\n return random.choice([\n "Interesting! Can you tell me more?",\n "I’m not sure I understand. Could you clarify?",\n "That’s cool! What else is on your mind?"\n ])\n\ninterface = gr.ChatInterface(\n fn=chatbot_response,\n title=f"Chatbot - {PARAMS.get('name', 'Default')}",\n description="A simple chatbot powered by Gradio. Say hello or ask how I am!"\n)\n\ninterface.launch()
|