iukhan commited on
Commit
401ffe2
·
verified ·
1 Parent(s): 94fefab

Create restaurant_chatbot.py

Browse files
Files changed (1) hide show
  1. restaurant_chatbot.py +20 -0
restaurant_chatbot.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Chatbot pipeline using Hugging Face's conversational model
5
+ chatbot = pipeline('conversational')
6
+
7
+ # Function to handle chatbot conversations
8
+ def chat(input_text):
9
+ response = chatbot(input_text)
10
+ return response[0]['generated_text']
11
+
12
+ # Gradio interface for the chatbot
13
+ with gr.Blocks() as chatbot_app:
14
+ user_input = gr.Textbox(label="Ask me anything (e.g., What are today's specials?)")
15
+ chat_button = gr.Button("Send")
16
+ chatbot_output = gr.Textbox(label="Chatbot Response")
17
+
18
+ chat_button.click(fn=chat, inputs=user_input, outputs=chatbot_output)
19
+
20
+ chatbot_app.launch()