|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd "$(dirname "$0")" |
|
|
|
|
|
ENV_NAME="sharp" |
|
|
PYTHON_VERSION="3.13" |
|
|
|
|
|
echo "======================================" |
|
|
echo " Sharp 3D Prediction - Web Interface" |
|
|
echo "======================================" |
|
|
echo "" |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
eval "$(conda shell.bash hook)" |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
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 "" |
|
|
|
|
|
|
|
|
python src/sharp/web/app.py |
|
|
|
|
|
|
|
|
read -p "Press Enter to exit..." |
|
|
|