BasilTh
Deploy updated SLM customer-support chatbot
aa36139
raw
history blame
882 Bytes
import os
os.environ["OMP_NUM_THREADS"] = "1" # Silence Gradio startup warning
import gradio as gr
from SLM_CService import chat_with_memory
def respond(user_message, history):
bot_reply = chat_with_memory(user_message)
history = history + [(user_message, bot_reply)]
return history, history
with gr.Blocks() as demo:
gr.Markdown("# πŸ›Ž Customer Support Chatbot")
chatbot = gr.Chatbot() # Replaces ChatInterface/FileMessage/TextMessage :contentReference[oaicite:8]{index=8}
with gr.Row():
user_in = gr.Textbox(placeholder="Type your message here...")
submit = gr.Button("Send")
reset = gr.Button("πŸ”„ Reset Chat")
submit.click(respond, [user_in, chatbot], [chatbot, chatbot])
reset.click(lambda: ([], []), None, [chatbot, chatbot])
if __name__ == "__main__":
demo.launch(server_name="0.0.0.0", server_port=7860)