File size: 1,337 Bytes
12e6fed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/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