Spaces:
Sleeping
Sleeping
Commit
·
fd58f73
1
Parent(s):
50444a1
revert app.py, change gradio version to 4.29
Browse files- app.py +6 -7
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,16 +1,15 @@
|
|
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 |
-
|
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
|
14 |
|
15 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
16 |
|
|
|
1 |
+
from transformers import pipeline, Conversation
|
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 |
+
conversation = chatbot(message)
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
return conversation[0]['generated_text']
|
13 |
|
14 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
15 |
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
gradio==
|
2 |
transformers==4.31.0
|
3 |
torch==2.0.1
|
|
|
1 |
+
gradio==4.29.0
|
2 |
transformers==4.31.0
|
3 |
torch==2.0.1
|