hugginRAG / main.py
geraskalnas's picture
Chatbot ui
d495c31 verified
raw
history blame
804 Bytes
import gradio as gr
def chatbot_response(user_input, history=[]):
# Simulate a bot response
bot_reply = "This is a simulated response."
# Update history
history.append({"user": user_input, "bot": bot_reply})
return bot_reply, history
# Gradio UI Setup
def gradio_interface():
with gr.Blocks() as chatbot_ui:
gr.Markdown("## Fake Chatbot UI")
user_input = gr.Textbox(label="User Input", placeholder="Type your message here...", lines=2)
chat_history = gr.Chatbot()
def respond(user_input, history):
bot_reply, history = chatbot_response(user_input, history)
return history, history
user_input.submit(respond, [user_input, chat_history], [chat_history, chat_history])
chatbot_ui.launch()
gradio_interface()