Spaces:
Runtime error
Runtime error
Download app.py from youngtsai/transformers_chat: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/youngtsai/transformers_chat/resolve/main/app.py
- Command line
-
hf download hf://spaces/youngtsai/transformers_chat/app.py
-
curl -L -o app.py https://huggingface.co/spaces/youngtsai/transformers_chat/resolve/main/app.py
631 Bytes
| from transformers import pipeline | |
| from transformers import Conversation | |
| import gradio as gr | |
| chatbot = pipeline(model="facebook/blenderbot-400M-distill") | |
| import gradio as gr | |
| message_list = [] | |
| response_list = [] | |
| def mini_chatbot(message, history): | |
| conversation = Conversation( | |
| text=message, | |
| past_user_inputs=message_list, | |
| generated_responses=response_list | |
| ) | |
| conversation = chatbot(conversation) | |
| return conversation.generated_responses[-1] | |
| demo_chatbot = gr.ChatInterface( | |
| mini_chatbot, | |
| title="My Chatbot", | |
| description="Enter text to start chatting." | |
| ) | |
| demo_chatbot.launch() |