Spaces:
Sleeping
Sleeping
Download app.py from 2012hhh2012/SmolLM2-135M-Instruct: direct link, hf CLI and curl.
- Browser
- Download file 482 Bytes
-
https://huggingface.co/spaces/2012hhh2012/SmolLM2-135M-Instruct/resolve/main/app.py
- Command line
-
hf download hf://spaces/2012hhh2012/SmolLM2-135M-Instruct/app.py
-
curl -L -o app.py https://huggingface.co/spaces/2012hhh2012/SmolLM2-135M-Instruct/resolve/main/app.py
482 Bytes
| import gradio as gr | |
| from llama_cpp import Llama | |
| llm = Llama.from_pretrained( | |
| repo_id="HackNetAyush/smollm2-135M-instruct-gguf-q8", | |
| filename="smollm2-135m-instruct-q8_0.gguf", | |
| n_ctx=8192, | |
| n_batch=1024, | |
| n_threads=2, | |
| verbose=False, | |
| ) | |
| def chat(message, history): | |
| response = llm.create_chat_completion( | |
| messages=[{"role": "user", "content": message}] | |
| ) | |
| return response["choices"][0]["message"]["content"] | |
| gr.ChatInterface(fn=chat).launch() | |