ZhJiHo commited on
Commit
46b37fe
·
verified ·
1 Parent(s): cc20466

Create app.py

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