Spaces:
Running
Running
app.py
CHANGED
@@ -121,12 +121,11 @@ def load_local_model_if_configured():
|
|
121 |
logger.warning("⚠️ llama_cpp غير متاح. لن يعمل النموذج المحلي.")
|
122 |
return
|
123 |
|
124 |
-
|
125 |
-
try:
|
126 |
logger.info(f"⬇️ تحميل نموذج GGUF: {LOCAL_GGUF_REPO}/{LOCAL_GGUF_FILE}")
|
127 |
llm = Llama.from_pretrained(
|
128 |
-
|
129 |
-
|
130 |
# Llama params
|
131 |
n_ctx=int(os.getenv("N_CTX", "32768")),
|
132 |
n_threads=int(os.getenv("N_THREADS", "2")),
|
@@ -213,7 +212,7 @@ def call_hf_inference(prompt: str, max_new_tokens: int = 900) -> str:
|
|
213 |
raise RuntimeError("تم تعطيل HF Inference. النموذج المحلي مستخدم فقط.")
|
214 |
|
215 |
def call_llm(prompt: str, max_tokens: int = 900) -> str:
|
216 |
-
|
217 |
|
218 |
# =========================
|
219 |
# بناء الـ Prompt للدردشة (نسخة مبسطة)
|
|
|
121 |
logger.warning("⚠️ llama_cpp غير متاح. لن يعمل النموذج المحلي.")
|
122 |
return
|
123 |
|
124 |
+
try:
|
|
|
125 |
logger.info(f"⬇️ تحميل نموذج GGUF: {LOCAL_GGUF_REPO}/{LOCAL_GGUF_FILE}")
|
126 |
llm = Llama.from_pretrained(
|
127 |
+
repo_id=LOCAL_GGUF_REPO,
|
128 |
+
filename=LOCAL_GGUF_FILE,
|
129 |
# Llama params
|
130 |
n_ctx=int(os.getenv("N_CTX", "32768")),
|
131 |
n_threads=int(os.getenv("N_THREADS", "2")),
|
|
|
212 |
raise RuntimeError("تم تعطيل HF Inference. النموذج المحلي مستخدم فقط.")
|
213 |
|
214 |
def call_llm(prompt: str, max_tokens: int = 900) -> str:
|
215 |
+
return call_local_llm(prompt, max_tokens)
|
216 |
|
217 |
# =========================
|
218 |
# بناء الـ Prompt للدردشة (نسخة مبسطة)
|