Spaces:
Runtime error
Runtime error
Download app.py from Wootang01/chatbot_three: direct link, hf CLI and curl.
- Browser
- Download file 530 Bytes
-
https://huggingface.co/spaces/Wootang01/chatbot_three/resolve/main/app.py
- Command line
-
hf download hf://spaces/Wootang01/chatbot_three/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Wootang01/chatbot_three/resolve/main/app.py
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() |