-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
60 lines (45 loc) · 1.26 KB
/
run.sh
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
#!/bin/bash
# Make sure the project is fully set up, this is just an run script to automate the project
# sh run.sh
# paths and other configurable elements
PROJECT_DIR='C:\Users\Jesvi Jonathan\Documents\github'
FRONTEND_DIR="$PROJECT_DIR\Snitch-GPT-Frontend"
BACKEND_DIR="$PROJECT_DIR\AI-Generated-Text-Detection"
PORT1=5173
PORT2=5000
cleanup_and_exit() {
echo "Stopping AI Detective and Chat Bot..."
kill -TERM -$node_pid -$python_pid
echo "Node.js process (PID $node_pid) and Python process (PID $python_pid) have been terminated."
exit 0
}
start_python_app() {
python app.py &
python_pid=$!
echo "Python process started (PID $python_pid)"
Start http://localhost:$PORT2/
}
cd "$FRONTEND_DIR"
npm run dev &
node_pid=$!
echo "Node.js process started (PID $node_pid)"
start http://localhost:$PORT1/
sleep 3
echo ""
echo "AI Detective is running in the background."
echo "Please open http://localhost:$PORT1/ in your browser."
echo ""
cd "$BACKEND_DIR"
# Activate the virtual environment
source "nig/Scripts/activate"
echo "Environment activated."
echo "Running Chat Bot in the background."
echo "Press 'x' to stop the Chat Bot."
start_python_app
while true; do
read -rsn1 key
if [ "$key" == "x" ]; then
cleanup_and_exit
fi
done
echo "Script Ended"