Spaces:
Running
Running
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!") | |