-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrade.sh
More file actions
executable file
·55 lines (49 loc) · 1.81 KB
/
Copy pathgrade.sh
File metadata and controls
executable file
·55 lines (49 loc) · 1.81 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
#!/bin/bash
# Exit on error
set -e
# Directory configurations
VENV_DIR="venv"
PYTHON_BIN="$VENV_DIR/bin/python3"
# 1. Ensure virtual environment exists
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment in '$VENV_DIR'..."
python3 -m venv "$VENV_DIR"
fi
# 2. Upgrade pip and install/verify dependencies inside the venv
echo "Verifying dependencies inside virtual environment..."
"$PYTHON_BIN" -m pip install --upgrade -q pip
"$PYTHON_BIN" -m pip install -q -r requirements.txt
# 3. Handle commands
COMMAND=${1:-"grade"}
case "$COMMAND" in
"grade")
echo "Running grade_responses.py inside the virtual environment..."
shift # Remove "grade" from argument list
# Execute the grading script using the venv Python
"$PYTHON_BIN" grade_responses.py "$@"
;;
"server")
echo "Starting local learning platform server on port 8089..."
echo "Navigate to: http://localhost:8089/index.html"
# Run Flask server
PORT=8089 "$PYTHON_BIN" server.py
;;
"help"|"-h"|"--help")
echo "Designing Data-Intensive Applications Learning App Runner"
echo ""
echo "Usage:"
echo " ./run.sh [command] [options]"
echo ""
echo "Commands:"
echo " grade [args] Run AI grading script (default command). All additional args are forwarded."
echo " e.g. ./run.sh grade --state customized_progress.json"
echo " server Start the local web server on port 8080 (http://localhost:8080)"
echo " help Show this help menu"
echo ""
;;
*)
# If it's not a known command, pass everything directly to the grading script
echo "Forwarding arguments to grade_responses.py..."
"$PYTHON_BIN" grade_responses.py "$@"
;;
esac