Spaces:
Runtime error
Runtime error
File size: 848 Bytes
163e91e |
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 |
import gradio as gr
from model.controller import Controller
# Initialize your controller
bot = Controller()
# Define chatbot function
def chatbot_interface(user_input, chat_id=2311):
return bot.handle_message(chat_id, user_input)
# Define Gradio interface
with gr.Blocks() as interface:
gr.Markdown("## RAG Law Chatbot")
chatbot = gr.Chatbot()
user_input = gr.Textbox(show_label=False, placeholder="Enter your law question...").style(container=False)
send_button = gr.Button("Send")
def chat_update(user_message, history):
history = history or []
bot_reply = chatbot_interface(user_message)
history.append((user_message, bot_reply))
return history, ""
send_button.click(chat_update, [user_input, chatbot], [chatbot, user_input])
# Launch the Gradio interface
interface.launch() |