app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline,Conversation
|
2 |
+
chatbot = pipeline(model="facebook/blenderbot-400M-distill")
|
3 |
+
|
4 |
+
import gradio as gr
|
5 |
+
message_list = []
|
6 |
+
response_list = []
|
7 |
+
|
8 |
+
def yes_man(message, history):
|
9 |
+
conversation = chatbot(message)
|
10 |
+
|
11 |
+
return conversation[0]['generated_text']
|
12 |
+
|
13 |
+
gr.ChatInterface(
|
14 |
+
yes_man,
|
15 |
+
chatbot=gr.Chatbot(height=300),
|
16 |
+
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
|
17 |
+
title="A vanilla chatbot",
|
18 |
+
description="Ask Yes Man any question",
|
19 |
+
theme="soft",
|
20 |
+
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
|
21 |
+
cache_examples=True,
|
22 |
+
retry_btn=None,
|
23 |
+
undo_btn="Delete Previous",
|
24 |
+
clear_btn="Clear",
|
25 |
+
).launch(share=True)
|