subhan971 commited on
Commit
05407e2
·
verified ·
1 Parent(s): 188b447

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +21 -17
start.sh CHANGED
@@ -1,22 +1,26 @@
1
  #!/bin/bash
2
 
3
- ollama serve &
 
4
 
5
- echo "Waiting for Ollama to be ready..."
6
- until curl -s http://localhost:11434/api/tags > /dev/null 2>&1; do
7
- echo "Ollama not ready yet, retrying..."
8
- sleep 3
9
- done
10
 
11
- echo "Ollama is ready! Pulling model..."
12
- ollama pull llama3.2:1b
 
13
 
14
- echo "Model ready! Starting Streamlit..."
15
- streamlit run app.py \
16
- --server.port=8501 \
17
- --server.address=0.0.0.0 \
18
- --server.headless=true \
19
- --server.fileWatcherType=none \
20
- --server.maxUploadSize=10 \
21
- --server.enableXsrfProtection=false \
22
- --server.enableCORS=false
 
 
 
 
 
 
 
1
  #!/bin/bash
2
 
3
+ # Exit on any error
4
+ set -e
5
 
6
+ echo "🚀 Starting Zouq-ul-ilm Notes Generator..."
 
 
 
 
7
 
8
+ # Ensure output directory is writable (for notes.pdf)
9
+ mkdir -p /app/tmp
10
+ chmod 777 /app/tmp
11
 
12
+ # Check if GROQ_API_KEY is set
13
+ if [ -z "$GROQ_API_KEY" ]; then
14
+ echo "⚠️ WARNING: GROQ_API_KEY is not set. Please add it in HuggingFace Space secrets."
15
+ else
16
+ echo "✅ GROQ_API_KEY found."
17
+ fi
18
+
19
+ echo "📚 Launching Streamlit app on port 7860..."
20
+
21
+ # Start Streamlit
22
+ exec streamlit run app.py \
23
+ --server.port=7860 \
24
+ --server.address=0.0.0.0 \
25
+ --server.headless=true \
26
+ --browser.gatherUsageStats=false