Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,9 @@ import os, time, json, re
|
|
| 2 |
import gradio as gr
|
| 3 |
from llama_cpp import Llama
|
| 4 |
|
|
|
|
| 5 |
MODEL_REPO = "QuantFactory/Phi-3.5-mini-instruct-GGUF"
|
| 6 |
-
MODEL_FILE = "Phi-3.5-mini-instruct
|
| 7 |
SAVE_PATH = "convos.jsonl"
|
| 8 |
MAX_RECALL = 5 # how many past turns to recall
|
| 9 |
|
|
@@ -40,7 +41,6 @@ def load_memory(query):
|
|
| 40 |
return []
|
| 41 |
with open(SAVE_PATH, "r", encoding="utf-8") as f:
|
| 42 |
lines = [json.loads(l) for l in f if l.strip()]
|
| 43 |
-
# naive keyword match
|
| 44 |
query_words = set(re.findall(r"\w+", query.lower()))
|
| 45 |
scored = []
|
| 46 |
for rec in lines:
|
|
@@ -56,7 +56,6 @@ def format_messages(system, history, user_msg):
|
|
| 56 |
if system.strip():
|
| 57 |
msgs.append({"role": "system", "content": system})
|
| 58 |
|
| 59 |
-
# Inject recalled memory
|
| 60 |
recalls = load_memory(user_msg)
|
| 61 |
if recalls:
|
| 62 |
mem_text = "\n".join(
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from llama_cpp import Llama
|
| 4 |
|
| 5 |
+
# ✅ Working public GGUF model
|
| 6 |
MODEL_REPO = "QuantFactory/Phi-3.5-mini-instruct-GGUF"
|
| 7 |
+
MODEL_FILE = "Phi-3.5-mini-instruct.Q4_K_M.gguf"
|
| 8 |
SAVE_PATH = "convos.jsonl"
|
| 9 |
MAX_RECALL = 5 # how many past turns to recall
|
| 10 |
|
|
|
|
| 41 |
return []
|
| 42 |
with open(SAVE_PATH, "r", encoding="utf-8") as f:
|
| 43 |
lines = [json.loads(l) for l in f if l.strip()]
|
|
|
|
| 44 |
query_words = set(re.findall(r"\w+", query.lower()))
|
| 45 |
scored = []
|
| 46 |
for rec in lines:
|
|
|
|
| 56 |
if system.strip():
|
| 57 |
msgs.append({"role": "system", "content": system})
|
| 58 |
|
|
|
|
| 59 |
recalls = load_memory(user_msg)
|
| 60 |
if recalls:
|
| 61 |
mem_text = "\n".join(
|