-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAI_Deck_Reconstructor.command
More file actions
executable file
·63 lines (52 loc) · 1.6 KB
/
Copy pathAI_Deck_Reconstructor.command
File metadata and controls
executable file
·63 lines (52 loc) · 1.6 KB
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
#!/bin/bash
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -L "$SOURCE" ]; do
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
done
APP_DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
VENV="$APP_DIR/.venv"
PYTHON="$VENV/bin/python"
PIP="$VENV/bin/pip"
PORT="5050"
URL="http://127.0.0.1:$PORT"
export PATH="$VENV/bin:$PATH"
echo ""
echo "AI Deck Reconstructor"
echo "====================="
echo ""
echo "App directory:"
echo "$APP_DIR"
echo ""
cd "$APP_DIR"
if [ ! -f "$PYTHON" ]; then
echo "Creating Python virtual environment..."
python3 -m venv "$VENV"
fi
echo "Installing / updating Python dependencies..."
"$PIP" install --upgrade pip >/dev/null
"$PIP" install -r requirements.txt
if [ -d "$APP_DIR/../ndlocr-lite" ]; then
if [ -f "$APP_DIR/../ndlocr-lite/pyproject.toml" ] || [ -f "$APP_DIR/../ndlocr-lite/setup.py" ]; then
echo "Installing local NDLOCR-Lite package from ../ndlocr-lite ..."
"$PIP" install -e "$APP_DIR/../ndlocr-lite"
else
echo "Found ../ndlocr-lite, but no pyproject.toml or setup.py was found."
echo "Skipping editable package installation."
fi
else
echo "⚠ NDLOCR-Lite folder was not found at ../ndlocr-lite."
echo "OCR may not work until NDLOCR-Lite is installed and configured."
fi
if [[ "$(uname)" == "Darwin" ]]; then
(sleep 2; open "$URL" >/dev/null 2>&1) &
fi
echo ""
echo "Starting local server..."
echo "$URL"
echo ""
echo "Press Ctrl+C in this window to stop the server."
echo ""
exec "$PYTHON" -m flask --app ui.app run --host 127.0.0.1 --port "$PORT"