Download app.py from ZPRIA/ZPRIA-AI: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/ZPRIA/ZPRIA-AI/resolve/main/app.py
- Command line
-
hf download hf://spaces/ZPRIA/ZPRIA-AI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ZPRIA/ZPRIA-AI/resolve/main/app.py
542 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Model load (stable + public) | |
| generator = pipeline( | |
| "text-generation", | |
| model="distilgpt2" | |
| ) | |
| # Chat function | |
| def chat(message): | |
| result = generator( | |
| message, | |
| max_new_tokens=100, | |
| do_sample=True, | |
| temperature=0.7 | |
| ) | |
| return result[0]["generated_text"] | |
| # Gradio interface (UI minimal, API usable) | |
| demo = gr.Interface( | |
| fn=chat, | |
| inputs=gr.Textbox(placeholder="Type..."), | |
| outputs=gr.Textbox(), | |
| title="ZPRIA AI" | |
| ) | |
| demo.launch() |