kikalore commited on
Commit
2aebdca
·
verified ·
1 Parent(s): 6458efc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -8,9 +8,11 @@
8
  import gradio as gr
9
  from llama_cpp import Llama
10
 
11
- # Percorso al tuo modello GGUF ospitato su HuggingFace
12
  MODEL_REPO = "kikalore/iris"
13
- MODEL_FILE = "model-3b-Q4_K_M.gguf" # assicurati che il nome sia corretto nel repo model!
 
 
14
 
15
  llm = Llama.from_pretrained(
16
  repo_id=MODEL_REPO,
@@ -20,6 +22,7 @@ llm = Llama.from_pretrained(
20
  )
21
 
22
  def chat(message, history):
 
23
  prompt = ""
24
  for human, bot in history:
25
  prompt += f"<|user|>{human}\n<|assistant|>{bot}\n"
@@ -28,8 +31,9 @@ def chat(message, history):
28
  output = llm(prompt, max_tokens=350)
29
  return output["choices"][0]["text"].strip()
30
 
31
- gr.ChatInterface(
32
  fn=chat,
33
- title="Iris – Fine-tuned LLM"
34
- ).launch()
35
 
 
 
8
  import gradio as gr
9
  from llama_cpp import Llama
10
 
11
+ # Modello .gguf ospitato nel repo del modello
12
  MODEL_REPO = "kikalore/iris"
13
+ MODEL_FILE = "model-3b-Q4_K_M.gguf"
14
+
15
+ print("Loading model...")
16
 
17
  llm = Llama.from_pretrained(
18
  repo_id=MODEL_REPO,
 
22
  )
23
 
24
  def chat(message, history):
25
+ # costruisci contesto della conversazione
26
  prompt = ""
27
  for human, bot in history:
28
  prompt += f"<|user|>{human}\n<|assistant|>{bot}\n"
 
31
  output = llm(prompt, max_tokens=350)
32
  return output["choices"][0]["text"].strip()
33
 
34
+ demo = gr.ChatInterface(
35
  fn=chat,
36
+ title="Iris – Fine-Tuned LLM"
37
+ )
38
 
39
+ demo.launch()