Wizz13150 commited on
Commit
c904a84
·
1 Parent(s): b1548a4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ # Charger le modèle GGUF (Q8_0)
5
+ llm = Llama(
6
+ model_path="model/gptq_model.gguf",
7
+ n_threads=1,
8
+ n_ctx=2048,
9
+ n_batch=64,
10
+ use_mlock=True
11
+ )
12
+
13
+ def generate(prompt):
14
+ output = llm(prompt, max_tokens=200, stop=["</s>"], echo=False)
15
+ return output["choices"][0]["text"]
16
+
17
+ # UI Gradio
18
+ iface = gr.Interface(fn=generate,
19
+ inputs=gr.Textbox(lines=5, label="Prompt"),
20
+ outputs=gr.Textbox(label="Réponse"),
21
+ title="WizzGPT - CPU Demo")
22
+
23
+ iface.launch()