Spaces:
Runtime error
Runtime error
#import model class and tokenizer | |
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration | |
#import model class and tokenizer | |
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration | |
#download and setup the model and tokenizer | |
model_name = 'facebook/blenderbot-400M-distill' | |
tokenizer = BlenderbotTokenizer.from_pretrained(model_name) | |
model = BlenderbotForConditionalGeneration.from_pretrained(model_name) | |
def func (message): | |
inputs = tokenizer(message, return_tensors="pt") | |
result = model.generate(**inputs) | |
return tokenizer.decode(result[0]) | |
import gradio as gr | |
app = gr.Interface(fn=func, inputs="textbox", outputs="textbox", title="Conversation Bot") | |
app.launch() |