Download app.py from magkey/chat_abc: direct link, hf CLI and curl.
- Browser
- Download file 449 Bytes
-
https://huggingface.co/spaces/magkey/chat_abc/resolve/main/app.py
- Command line
-
hf download hf://spaces/magkey/chat_abc/app.py
-
curl -L -o app.py https://huggingface.co/spaces/magkey/chat_abc/resolve/main/app.py
449 Bytes
| from transformers import pipeline, Conversation | |
| import gradio as gr | |
| chatbot = pipeline(model="microsoft/DialoGPT-medium") | |
| def chat(input_text): | |
| conversation = Conversation(input_text) | |
| conversation = chatbot(conversation) | |
| return conversation.generated_responses[-1] | |
| iface = gr.Interface(fn=chat, | |
| inputs=gr.inputs.Textbox(lines=2, placeholder="Type here..."), | |
| outputs="text") | |
| iface.launch() | |