mfernezir commited on
Commit
bc9b9d6
·
1 Parent(s): 6c75113

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, Conversation
2
+ import gradio as gr
3
+
4
+ chatbot = pipeline(model="facebook/blenderbot-400M-distill")
5
+
6
+ message_list = []
7
+ response_list = []
8
+
9
+ def vanilla_chatbot(message, history):
10
+ conversation = Conversation(
11
+ text=message, past_user_inputs=message_list,
12
+ generated_responses=response_list)
13
+ conversation = chatbot(conversation)
14
+
15
+ return conversation.generated_responses[-1]
16
+
17
+ demo_chatbot = gr.ChatInterface(
18
+ vanilla_chatbot, title="Vanilla Chatbot",
19
+ description="Enter text to start chatting.")
20
+
21
+ demo_chatbot.launch()