File size: 959 Bytes
c9af3a5
 
194a0fe
ecc8436
194a0fe
f7c79fc
194a0fe
f7c79fc
 
194a0fe
ecc8436
194a0fe
a6f1452
194a0fe
 
 
 
 
a6f1452
f7c79fc
194a0fe
f7c79fc
 
 
194a0fe
f7c79fc
194a0fe
 
c9af3a5
194a0fe
c9af3a5
194a0fe
1f2fea2
 
c9af3a5
 
 
194a0fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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()