Wootang01 commited on
Commit
a653fea
1 Parent(s): 7ae5188

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
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()