Delete app.py
Browse files
app.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from llama_cpp import Llama
|
| 3 |
-
|
| 4 |
-
# Modello su HuggingFace Hub
|
| 5 |
-
model_repo = "kikalore/iris"
|
| 6 |
-
model_file = "model-3b-Q4_K_M.gguf" # cambialo con il nome esatto del tuo file
|
| 7 |
-
|
| 8 |
-
llm = Llama.from_pretrained(
|
| 9 |
-
repo_id=model_repo,
|
| 10 |
-
filename=model_file,
|
| 11 |
-
n_ctx=4096,
|
| 12 |
-
n_threads=4
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
def chat(message, history):
|
| 16 |
-
prompt = ""
|
| 17 |
-
for human, bot in history:
|
| 18 |
-
prompt += f"<|user|>{human}\n<|assistant|>{bot}\n"
|
| 19 |
-
prompt += f"<|user|>{message}\n<|assistant|>"
|
| 20 |
-
|
| 21 |
-
output = llm(prompt, max_tokens=512)
|
| 22 |
-
return output["choices"][0]["text"]
|
| 23 |
-
|
| 24 |
-
gr.ChatInterface(
|
| 25 |
-
fn=chat,
|
| 26 |
-
title="Fine-Tuned LLM"
|
| 27 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|