File size: 754 Bytes
912e356
deafbd7
912e356
deafbd7
 
912e356
 
 
 
 
 
deafbd7
912e356
 
 
 
 
deafbd7
912e356
 
fa3c0c0
912e356
deafbd7
912e356
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
import gradio as gr

import app


# Define the chatbot function
def chatbot_response(user_input, history):
    history = history or []
    response = app.chatbot_response(user_input)  # Call the chatbot logic
    history.append((user_input, response))
    return history, history

# Create the Gradio interface
with gr.Blocks() as demo:
    chatbot = gr.Chatbot(label="Chat with Me")
    msg = gr.Textbox(label="Your Message")
    clear = gr.Button("Clear")

    msg.submit(chatbot_response, [msg, chatbot], [chatbot, msg])
    clear.click(lambda: None, None, chatbot, queue=False)

# Launch the interface

#demo = gr.Interface(fn=chatbot_response, inputs="text", outputs="text", title="My Personal Chatbot", description="Ask me anything about myself!")