antofra10's picture
Port changes from Milestone-5
2a2521b
raw
history blame
1.51 kB
#!/bin/bash
# Fail on error
set -e
# Ensure DVC is initialized (in case .dvc folder was not copied)
if [ ! -d ".dvc" ]; then
echo "Initializing DVC..."
dvc init --no-scm
dvc remote add -d origin https://dagshub.com/se4ai2526-uniba/Hopcroft.dvc
fi
# Determine credentials
# Prefer specific DAGSHUB vars, fallback to MLFLOW vars (often the same for DagsHub)
USER=${DAGSHUB_USERNAME:-$MLFLOW_TRACKING_USERNAME}
PASS=${DAGSHUB_TOKEN:-$MLFLOW_TRACKING_PASSWORD}
if [ -n "$USER" ] && [ -n "$PASS" ]; then
echo "Configuring DVC authentication for DagsHub..."
# Configure local config (not committed)
dvc remote modify origin --local auth basic
dvc remote modify origin --local user "$USER"
dvc remote modify origin --local password "$PASS"
else
echo "WARNING: No DagsHub credentials found. DVC pull might fail if the remote is private."
fi
echo "Pulling models from DVC..."
# Pull only the necessary files for inference
dvc pull models/random_forest_tfidf_gridsearch.pkl.dvc \
models/tfidf_vectorizer.pkl.dvc \
models/label_names.pkl.dvc
echo "Starting FastAPI application in background..."
uvicorn hopcroft_skill_classification_tool_competition.main:app --host 0.0.0.0 --port 8000 &
# Wait for API to start
echo "Waiting for API to start..."
sleep 10
echo "Starting Streamlit application..."
export API_BASE_URL="http://localhost:8000"
streamlit run hopcroft_skill_classification_tool_competition/streamlit_app.py --server.port 7860 --server.address 0.0.0.0