Spaces:
Sleeping
Sleeping
rajeshmelur
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, generated_responses=response_list)
|
8 |
+
bot = chatbot(conversation.messages[0]['content']) # working code
|
9 |
+
return bot[-1]['generated_text']
|
10 |
+
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Mashdemy Chatbot", description="Enter text to start chatting.")
|
11 |
+
demo_chatbot.launch(share = True)
|