File size: 2,705 Bytes
6fe70f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Sharp Web Interface - One-Click Launcher
# Double-click this file to start the Sharp web interface

# Change to the script's directory
cd "$(dirname "$0")"

ENV_NAME="sharp"
PYTHON_VERSION="3.13"

echo "======================================"
echo "  Sharp 3D Prediction - Web Interface"
echo "======================================"
echo ""

# Check if conda is available
if ! command -v conda &> /dev/null; then
    echo "❌ Conda is not installed or not in PATH."
    echo ""
    echo "Please install Miniconda or Anaconda first:"
    echo "  https://docs.conda.io/en/latest/miniconda.html"
    echo ""
    read -p "Press Enter to exit..."
    exit 1
fi

# Initialize conda for this shell session
eval "$(conda shell.bash hook)"

# Check if the environment exists
if ! conda env list | grep -q "^${ENV_NAME} "; then
    echo "πŸ“¦ Creating conda environment '${ENV_NAME}' with Python ${PYTHON_VERSION}..."
    conda create -n "$ENV_NAME" python="$PYTHON_VERSION" -y
    if [ $? -ne 0 ]; then
        echo "❌ Failed to create conda environment."
        read -p "Press Enter to exit..."
        exit 1
    fi
    echo "βœ… Environment created."
    echo ""
fi

# Activate the environment
echo "πŸ”„ Activating conda environment '${ENV_NAME}'..."
conda activate "$ENV_NAME"
if [ $? -ne 0 ]; then
    echo "❌ Failed to activate conda environment."
    read -p "Press Enter to exit..."
    exit 1
fi

# Check if sharp is installed by trying to import it
echo "πŸ” Checking if dependencies are installed..."
if ! python -c "import sharp" 2>/dev/null; then
    echo "πŸ“¦ Installing project dependencies (this may take a few minutes)..."
    pip install -r requirements.txt
    if [ $? -ne 0 ]; then
        echo "❌ Failed to install requirements."
        read -p "Press Enter to exit..."
        exit 1
    fi
    echo "βœ… Dependencies installed."
    echo ""
fi

# Check if web dependencies are installed
if ! python -c "import fastapi" 2>/dev/null; then
    echo "πŸ“¦ Installing web interface dependencies..."
    pip install -r src/sharp/web/requirements.txt
    if [ $? -ne 0 ]; then
        echo "❌ Failed to install web requirements."
        read -p "Press Enter to exit..."
        exit 1
    fi
    echo "βœ… Web dependencies installed."
    echo ""
fi

echo "======================================"
echo "πŸš€ Starting Sharp Web Interface..."
echo "======================================"
echo ""
echo "Open your browser and go to:"
echo ""
echo "  πŸ‘‰  http://localhost:8000"
echo ""
echo "Press Ctrl+C to stop the server."
echo ""

# Start the web server
python src/sharp/web/app.py

# Keep terminal open if server stops unexpectedly
read -p "Press Enter to exit..."