Spaces:
Runtime error
Runtime error
123LETSPLAY
commited on
Commit
•
d882890
1
Parent(s):
36d82ec
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline, Conversation
|
2 |
+
import gradio as gr
|
3 |
+
chatbot = pipeline(model="facebook/blenderbot-400M-distill")
|
4 |
+
message_list = []
|
5 |
+
response_list = []
|
6 |
+
def vanilla_chatbot(message, history):
|
7 |
+
conversation = Conversation(text=message, past_user_inputs=message_list,
|
8 |
+
generated_responses=response_list)
|
9 |
+
bot = chatbot(conversation.messages[0]['content']) # working code
|
10 |
+
return bot[-1]['generated_text']
|
11 |
+
|
12 |
+
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Mashdemy Chatbot", description=
|