astegaras commited on
Commit
222561c
·
verified ·
1 Parent(s): d62f436

Updated app

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -1,10 +1,21 @@
1
  import gradio as gr
2
- from mlx_lm import load, generate
 
3
 
4
- model, tokenizer = load("astegaras/Mistral-7B-FineTuned-MLX")
 
 
 
 
5
 
6
- def respond(prompt):
7
- return generate(model, tokenizer, prompt)
 
 
 
8
 
9
- gr.Interface(fn=respond, inputs="text", outputs="text").launch()
 
 
10
 
 
 
1
  import gradio as gr
2
+ from llama_cpp import Llama
3
+ from huggingface_hub import hf_hub_download
4
 
5
+ # Download GGUF to local file
6
+ model_path = hf_hub_download(
7
+ repo_id="astegaras/Llama3.2_3B",
8
+ filename="model-Q4_K_M.gguf"
9
+ )
10
 
11
+ llm = Llama(
12
+ model_path=model_path,
13
+ n_ctx=2048,
14
+ n_gpu_layers=0,
15
+ )
16
 
17
+ def respond(prompt):
18
+ out = llm(prompt, max_tokens=256)
19
+ return out["choices"][0]["text"]
20
 
21
+ gr.Interface(fn=respond, inputs="text", outputs="text").launch()