Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
|
4 |
+
|
5 |
+
tokenizer = BlenderbotTokenizer.from_pretrained('facebook/blenderbot-1B-distill')
|
6 |
+
model = BlenderbotForConditionalGeneration.from_pretrained('facebook/blenderbot-1B-distill')
|
7 |
+
|
8 |
+
def func (message):
|
9 |
+
inputs = tokenizer(message, return_tensors='pt')
|
10 |
+
result = model.generate(**inputs)
|
11 |
+
return tokenizer.decode(result[0])
|
12 |
+
|
13 |
+
app = gr.Interface(fn=func, inputs = 'textbox', outputs = 'textbox', title='Chatbot Three')
|
14 |
+
app.launch()
|