Spaces:
Runtime error
Runtime error
russkiyximik commited on
Commit ·
e8a0f6d
1
Parent(s): 58204bc
start ollama and pull from bash
Browse files- entrypoint.sh +8 -11
- mycoder/app.py +1 -6
entrypoint.sh
CHANGED
|
@@ -4,18 +4,15 @@ set -x # Enable command tracing for debugging
|
|
| 4 |
|
| 5 |
export PATH="$HOME/.local/bin:$PATH"
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# done
|
| 15 |
-
|
| 16 |
-
# # Pull the model
|
| 17 |
-
# echo "Pulling the model..."
|
| 18 |
-
# ollama pull gemma3:1b
|
| 19 |
|
| 20 |
# Start streamlit app
|
| 21 |
streamlit run mycoder/app.py --server.port=8501 --server.enableCORS=false
|
|
|
|
| 4 |
|
| 5 |
export PATH="$HOME/.local/bin:$PATH"
|
| 6 |
|
| 7 |
+
# Start Ollama server in the background
|
| 8 |
+
if ! nc -z localhost 7860; then
|
| 9 |
+
ollama serve &
|
| 10 |
+
fi
|
| 11 |
|
| 12 |
+
# Pull the model
|
| 13 |
+
timeout 15 bash -c 'until nc -z localhost 7860; do echo "Waiting for Ollama server..."; sleep 1; done'
|
| 14 |
+
echo "Pulling the model..."
|
| 15 |
+
ollama pull codellama:7b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Start streamlit app
|
| 18 |
streamlit run mycoder/app.py --server.port=8501 --server.enableCORS=false
|
mycoder/app.py
CHANGED
|
@@ -35,9 +35,4 @@ if st.button("Run Query2Plot"):
|
|
| 35 |
if os.path.exists("output/plot.png"):
|
| 36 |
st.image("output/plot.png", caption="Generated Figure")
|
| 37 |
|
| 38 |
-
|
| 39 |
-
from ollamaini import start_ollama, start_model
|
| 40 |
-
start_ollama()
|
| 41 |
-
import time
|
| 42 |
-
time.sleep(20) # Wait for Ollama to start
|
| 43 |
-
start_model()
|
|
|
|
| 35 |
if os.path.exists("output/plot.png"):
|
| 36 |
st.image("output/plot.png", caption="Generated Figure")
|
| 37 |
|
| 38 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|