Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
chatbot = pipeline(model=
|
| 3 |
message_list = []
|
| 4 |
response_list = []
|
|
|
|
|
|
|
| 5 |
def vanilla_chatbot(message, history):
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
import gradio as gr
|
| 4 |
+
chatbot = pipeline(model='facebook/blenderbot-400M-distill')
|
| 5 |
message_list = []
|
| 6 |
response_list = []
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def vanilla_chatbot(message, history):
|
| 10 |
+
conversation = Conversation(text=message,
|
| 11 |
+
past_user_inputs=message_list,
|
| 12 |
+
generated_responses=response_list)
|
| 13 |
+
bot = chatbot(conversation.messages[0]['content']) # working code
|
| 14 |
+
return bot[-1]['generated_text']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
demo_chatbot = gr.ChatInterface(vanilla_chatbot,
|
| 18 |
+
title='Mashdemy Chatbot',
|
| 19 |
+
description='Enter text to start chatting.'
|
| 20 |
+
)
|
| 21 |
+
demo_chatbot.launch(share=True)
|