CARHELPER / app.py
onstop321's picture
Create app.py
75ba1ca verified
raw
history blame
697 Bytes
import gradio as gr
messages = []
def chatbot(user_input):
global messages
messages.append(("user", user_input))
reply = f"I received: {user_input}\n(This is where your manual/model will connect later.)"
messages.append(("assistant", reply))
return messages
with gr.Blocks() as demo:
chatbot_ui = gr.Chatbot()
msg = gr.Textbox(placeholder="Ask me anything about your Sierra or caravan...")
clear = gr.Button("Clear")
def respond(message, chat_history):
bot_reply = chatbot(message)
return bot_reply, ""
msg.submit(respond, [msg, chatbot_ui], [chatbot_ui, msg])
clear.click(lambda: None, None, chatbot_ui, queue=False)
demo.launch()