Download app.py from DGRDN/Chattbot: direct link, hf CLI and curl.
- Browser
- Download file 768 Bytes
-
https://huggingface.co/spaces/DGRDN/Chattbot/resolve/main/app.py
- Command line
-
hf download hf://spaces/DGRDN/Chattbot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/DGRDN/Chattbot/resolve/main/app.py
768 Bytes
| import gradio as gr | |
| from transformers import pipeline, Conversation | |
| chatbot = pipeline("conversational", model="microsoft/DialoGPT-small") | |
| def chat_with_bot(user_input, history=[]): | |
| conversation = Conversation(user_input) | |
| convo = chatbot(conversation) | |
| response = convo.generated_responses[-1] | |
| history.append((user_input, response)) | |
| return response, history | |
| demo = gr.Interface( | |
| fn=chat_with_bot, | |
| inputs=[ | |
| gr.Textbox(lines=2, placeholder="Say something..."), | |
| gr.State() | |
| ], | |
| outputs=[ | |
| gr.Textbox(lines=6, label="🤖 Bot says"), | |
| gr.State() | |
| ], | |
| title="💬 Everyday Chatbot", | |
| description="Talk to your AI buddy about anything — life, school, ideas, or just random stuff!" | |
| ) | |
| demo.launch() |