#!/bin/bash # Tunnel Crack Detection App Launcher echo "🔍 Starting Tunnel Crack Detection App..." # Check if virtual environment exists if [ -d "venv" ]; then echo "đŸ“Ļ Activating virtual environment..." source venv/bin/activate else echo "âš ī¸ Virtual environment not found. Consider creating one:" echo " python -m venv venv" echo " source venv/bin/activate" echo " pip install -r requirements.txt" echo "" fi # Check if default model exists DEFAULT_MODEL="/Users/sompoteyouwai/env/model_weight/segment_defect.pt" if [ -f "$DEFAULT_MODEL" ]; then echo "✅ Default model found: $DEFAULT_MODEL" else echo "âš ī¸ Default model not found at: $DEFAULT_MODEL" echo " You can still upload a custom model through the web interface" fi # Check if requirements are installed echo "🔧 Checking dependencies..." python -c "import streamlit, torch, ultralytics" 2>/dev/null if [ $? -eq 0 ]; then echo "✅ Dependencies verified" else echo "❌ Missing dependencies. Installing..." pip install -r requirements.txt fi echo "" echo "🚀 Launching Streamlit app..." echo "📱 Open your browser to: http://localhost:8501" echo "âšī¸ Press Ctrl+C to stop the server" echo "" # Launch Streamlit streamlit run streamlit_app.py --server.port 8501 --server.address localhost