chatbot_three / app.py
Wootang01's picture
Create app.py
a653fea
raw
history blame contribute delete
530 Bytes
import gradio as gr
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
tokenizer = BlenderbotTokenizer.from_pretrained('facebook/blenderbot-1B-distill')
model = BlenderbotForConditionalGeneration.from_pretrained('facebook/blenderbot-1B-distill')
def func (message):
inputs = tokenizer(message, return_tensors='pt')
result = model.generate(**inputs)
return tokenizer.decode(result[0])
app = gr.Interface(fn=func, inputs = 'textbox', outputs = 'textbox', title='Chatbot Three')
app.launch()