rms / restaurant_chatbot.py
iukhan's picture
Create restaurant_chatbot.py
401ffe2 verified
raw
history blame contribute delete
647 Bytes
from transformers import pipeline
import gradio as gr
# Chatbot pipeline using Hugging Face's conversational model
chatbot = pipeline('conversational')
# Function to handle chatbot conversations
def chat(input_text):
response = chatbot(input_text)
return response[0]['generated_text']
# Gradio interface for the chatbot
with gr.Blocks() as chatbot_app:
user_input = gr.Textbox(label="Ask me anything (e.g., What are today's specials?)")
chat_button = gr.Button("Send")
chatbot_output = gr.Textbox(label="Chatbot Response")
chat_button.click(fn=chat, inputs=user_input, outputs=chatbot_output)
chatbot_app.launch()