Update entrypoint.sh
Browse files- entrypoint.sh +13 -11
entrypoint.sh
CHANGED
|
@@ -1,30 +1,32 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
# 1.
|
| 4 |
-
|
| 5 |
-
MODEL_PATH="/app/models/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf"
|
| 6 |
|
| 7 |
# Check if model exists
|
| 8 |
if [ -f "$MODEL_PATH" ]; then
|
| 9 |
-
echo "✅ Nur Brain is already in storage."
|
| 10 |
else
|
| 11 |
-
echo "⏳ Brain missing. Downloading via Python API..."
|
| 12 |
|
| 13 |
# Ensure the directory exists
|
| 14 |
mkdir -p /app/models
|
| 15 |
|
| 16 |
# ⬇️ DOWNLOAD SECTION ⬇️
|
|
|
|
| 17 |
python3 -c "
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
import os
|
| 20 |
try:
|
| 21 |
path = hf_hub_download(
|
| 22 |
-
repo_id='
|
| 23 |
-
filename='
|
| 24 |
local_dir='/app/models',
|
| 25 |
local_dir_use_symlinks=False
|
| 26 |
)
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
except Exception as e:
|
| 29 |
print(f'❌ Download failed: {e}')
|
| 30 |
exit(1)
|
|
@@ -33,11 +35,11 @@ fi
|
|
| 33 |
|
| 34 |
# Double check
|
| 35 |
if [ ! -f "$MODEL_PATH" ]; then
|
| 36 |
-
echo "❌ CRITICAL:
|
| 37 |
exit 1
|
| 38 |
fi
|
| 39 |
|
| 40 |
-
echo "🚀 Starting Nur Brain
|
| 41 |
|
| 42 |
-
# 3.
|
| 43 |
exec uvicorn app.main:app --host 0.0.0.0 --port 7860
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# 1. UPDATED: Path to our new Qwen3 model
|
| 4 |
+
MODEL_PATH="/app/models/nur.gguf"
|
|
|
|
| 5 |
|
| 6 |
# Check if model exists
|
| 7 |
if [ -f "$MODEL_PATH" ]; then
|
| 8 |
+
echo "✅ Nur Brain (Qwen3) is already in storage."
|
| 9 |
else
|
| 10 |
+
echo "⏳ Brain missing. Downloading Qwen3 via Python API..."
|
| 11 |
|
| 12 |
# Ensure the directory exists
|
| 13 |
mkdir -p /app/models
|
| 14 |
|
| 15 |
# ⬇️ DOWNLOAD SECTION ⬇️
|
| 16 |
+
# We are using Qwen3-1.7B-Instruct (GGUF) for speed and Quran/Hadith knowledge
|
| 17 |
python3 -c "
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
import os
|
| 20 |
try:
|
| 21 |
path = hf_hub_download(
|
| 22 |
+
repo_id='Qwen/Qwen3-1.7B-Instruct-GGUF',
|
| 23 |
+
filename='qwen3-1_7b-instruct-q4_k_m.gguf',
|
| 24 |
local_dir='/app/models',
|
| 25 |
local_dir_use_symlinks=False
|
| 26 |
)
|
| 27 |
+
# Rename to nur.gguf so our app code never has to change
|
| 28 |
+
os.rename(path, '/app/models/nur.gguf')
|
| 29 |
+
print('✅ Qwen3 Download complete!')
|
| 30 |
except Exception as e:
|
| 31 |
print(f'❌ Download failed: {e}')
|
| 32 |
exit(1)
|
|
|
|
| 35 |
|
| 36 |
# Double check
|
| 37 |
if [ ! -f "$MODEL_PATH" ]; then
|
| 38 |
+
echo "❌ CRITICAL: Qwen3 model file still missing."
|
| 39 |
exit 1
|
| 40 |
fi
|
| 41 |
|
| 42 |
+
echo "🚀 Starting Nur Brain (Qwen3) on Port 7860..."
|
| 43 |
|
| 44 |
+
# 3. Port 7860 is mandatory for Hugging Face Spaces
|
| 45 |
exec uvicorn app.main:app --host 0.0.0.0 --port 7860
|