Spaces:
Paused

isam0 commited on
Commit
2c8db2f
·
verified ·
1 Parent(s): 1321f43

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +13 -11
entrypoint.sh CHANGED
@@ -1,30 +1,32 @@
1
  #!/bin/bash
2
 
3
- # 1. FIX: Changed port to 7860 (HF Requirement)
4
- # 2. FIX: Path should match what we use in app/config.py
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='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF',
23
- filename='Meta-Llama-3-8B-Instruct.Q4_K_M.gguf',
24
  local_dir='/app/models',
25
  local_dir_use_symlinks=False
26
  )
27
- print(f'✅ Download complete to {path}')
 
 
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: Model file still missing."
37
  exit 1
38
  fi
39
 
40
- echo "🚀 Starting Nur Brain API on Port 7860..."
41
 
42
- # 3. FIX: Port 7860 is mandatory for Hugging Face Spaces
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