Spaces:
Paused
Paused
Download app.py from solartechnology/Argos-1: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/solartechnology/Argos-1/resolve/main/app.py
- Command line
-
hf download hf://spaces/solartechnology/Argos-1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/solartechnology/Argos-1/resolve/main/app.py
1.02 kB
| import gradio as gr | |
| from huggingface_hub import hf_hub_download | |
| from llama_cpp import Llama | |
| # A MODIFIER : ton pseudo Hugging Face et le nom du fichier GGUF | |
| REPO_ID = "solartechnology/ziggy-qwen-gguf" | |
| FICHIER = "unsloth.Q4_K_M.gguf" | |
| chemin = hf_hub_download(repo_id=REPO_ID, filename=FICHIER) | |
| llm = Llama(model_path=chemin, n_ctx=2048, n_threads=2, verbose=False) | |
| def repondre(message, historique): | |
| systeme = {"role": "system", "content": "Tu es Ziggy, un assistant sympa, curieux et un peu déjanté, bon en programmation, en maths et en imagination. Tu réponds en français."} | |
| messages = [systeme] + list(historique) + [{"role": "user", "content": message}] | |
| sortie = llm.create_chat_completion( | |
| messages=messages, max_tokens=400, temperature=0.7 | |
| ) | |
| return sortie["choices"][0]["message"]["content"] | |
| # api_name="ziggy" permet de l'appeler depuis du code, sans passer par la page web | |
| demo = gr.ChatInterface(repondre, type="messages", title="Ziggy", api_name="ziggy") | |
| demo.launch() | |