Spaces:
Sleeping
Sleeping
Commit
·
50444a1
1
Parent(s):
8281db6
changed app.py to manage str or list error
Browse files
app.py
CHANGED
@@ -1,19 +1,17 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
chatbot = pipeline(model="facebook/blenderbot-400M-distill")
|
5 |
|
6 |
-
message_list = []
|
7 |
-
response_list = []
|
8 |
-
|
9 |
def vanilla_chatbot(message, history):
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
16 |
|
17 |
-
demo_chatbot.launch()
|
18 |
-
|
19 |
-
# change to trigger rebuild after push
|
|
|
1 |
+
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
chatbot = pipeline(model="facebook/blenderbot-400M-distill")
|
5 |
|
|
|
|
|
|
|
6 |
def vanilla_chatbot(message, history):
|
7 |
+
# Combine the history and the new message
|
8 |
+
full_message = "\n".join([f"{h[0]}\n{h[1]}" for h in history] + [message])
|
9 |
+
|
10 |
+
# Generate a response using the chatbot
|
11 |
+
response = chatbot(full_message, max_length=1000, do_sample=True, top_p=0.95, top_k=50)[0]['generated_text']
|
12 |
+
|
13 |
+
return response
|
14 |
|
15 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
16 |
|
17 |
+
demo_chatbot.launch()
|
|
|
|