Download app.py from Ruby-chan/my-bot-ai: direct link, hf CLI and curl.
- Browser
- Download file 450 Bytes
-
https://huggingface.co/spaces/Ruby-chan/my-bot-ai/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ruby-chan/my-bot-ai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ruby-chan/my-bot-ai/resolve/main/app.py
450 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| generator = pipeline("text-generation", model="distilgpt2") | |
| def chat(message): | |
| result = generator(message, max_length=200, do_sample=True) | |
| return result[0]['generated_text'] | |
| iface = gr.Interface( | |
| fn=chat, | |
| inputs="text", | |
| outputs="text", | |
| title="AI Bot", | |
| description="Gửi câu hỏi, nhận câu trả lời từ AI." | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() |