Download app.py from as9coder/ai: direct link, hf CLI and curl.
- Browser
- Download file 320 Bytes
-
https://huggingface.co/spaces/as9coder/ai/resolve/main/app.py
- Command line
-
hf download hf://spaces/as9coder/ai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/as9coder/ai/resolve/main/app.py
320 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load AI model (GPT-Neo) | |
| chatbot = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B", device=-1) # Runs on CPU | |
| def chat(prompt): | |
| return chatbot(prompt)[0]['generated_text'] | |
| # Create UI | |
| gr.Interface(fn=chat, inputs="text", outputs="text").launch() | |