bot / app.py
Guhanselvam's picture
Update app.py
32de66a verified
raw
history blame contribute delete
935 Bytes
import gradio as gr
chatbot_instance = LlamaChatbot()
def respond(user_input, history):
# Get the bot's response using the updated history
bot_response = chatbot_instance.get_response(user_input, history)
# Update history to include the user's input and the bot's response
updated_history = history + user_input + "\n" + bot_response + "\n"
return bot_response, updated_history
interface = gr.Interface(
fn=respond,
inputs=[
gr.inputs.Textbox(label="User Input"),
gr.inputs.Textbox(label="Conversation History", lines=4, placeholder="You can see the history here...", interactive=False)
],
outputs=[
gr.outputs.Textbox(label="Bot Response"),
gr.outputs.Textbox(label="Updated History")
],
title="LLaMA Chatbot",
description="Chat with the LLaMA 3.2 7B model. Type your message and see the response."
)
# Launch the Gradio interface
interface.launch()