Download app.py from azilll/Azil: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/spaces/azilll/Azil/resolve/main/app.py
- Command line
-
hf download hf://spaces/azilll/Azil/app.py
-
curl -L -o app.py https://huggingface.co/spaces/azilll/Azil/resolve/main/app.py
652 Bytes
| from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline | |
| import gradio as gr | |
| import torch | |
| # Use smaller model that works on free GPUs | |
| model_id = "tiiuae/falcon-rw-1b" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained(model_id) | |
| generator = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=200) | |
| def jari_chat(message): | |
| prompt = f"User: {message}\nJari:" | |
| output = generator(prompt)[0]["generated_text"] | |
| return output.replace(prompt, "").strip() | |
| gr.Interface(fn=jari_chat, inputs="text", outputs="text", title="Jari - Lightweight AI Chatbot").launch() |