Spaces:
Running
Running
fixing app crash
Browse files
app.py
CHANGED
|
@@ -1,17 +1,30 @@
|
|
| 1 |
import subprocess
|
| 2 |
import sys
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
import gradio as gr
|
|
|
|
| 11 |
from agent import respond, build_prompt
|
| 12 |
from llama_cpp import Llama
|
| 13 |
import random
|
| 14 |
-
|
| 15 |
# ---------------- CONFIG ----------------
|
| 16 |
BASE_REPO_ID = "unsloth/Llama-3.2-3B-Instruct-GGUF"
|
| 17 |
BASE_FILENAME = "Llama-3.2-3B-Instruct-Q4_K_M.gguf"
|
|
|
|
| 1 |
import subprocess
|
| 2 |
import sys
|
| 3 |
|
| 4 |
+
print("--- STARTING INSTALLATION ---")
|
| 5 |
+
try:
|
| 6 |
+
# 1. Install llama-cpp-python
|
| 7 |
+
subprocess.run(
|
| 8 |
+
[sys.executable, "-m", "pip", "install", "-U", "llama-cpp-python==0.3.16"],
|
| 9 |
+
check=True,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
# 2. Install wikipedia (Second command - FORCES install)
|
| 13 |
+
print("--- INSTALLING WIKIPEDIA ---")
|
| 14 |
+
subprocess.run(
|
| 15 |
+
[sys.executable, "-m", "pip", "install", "wikipedia"],
|
| 16 |
+
check=True,
|
| 17 |
+
)
|
| 18 |
+
print("--- WIKIPEDIA INSTALLED ---")
|
| 19 |
+
except Exception as e:
|
| 20 |
+
print(f"--- INSTALLATION FAILED: {e} ---")
|
| 21 |
|
| 22 |
import gradio as gr
|
| 23 |
+
import wikipedia # This will now work
|
| 24 |
from agent import respond, build_prompt
|
| 25 |
from llama_cpp import Llama
|
| 26 |
import random
|
| 27 |
+
|
| 28 |
# ---------------- CONFIG ----------------
|
| 29 |
BASE_REPO_ID = "unsloth/Llama-3.2-3B-Instruct-GGUF"
|
| 30 |
BASE_FILENAME = "Llama-3.2-3B-Instruct-Q4_K_M.gguf"
|