-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart-frontend.sh
More file actions
executable file
·89 lines (74 loc) · 2.23 KB
/
Copy pathstart-frontend.sh
File metadata and controls
executable file
·89 lines (74 loc) · 2.23 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
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
#!/bin/bash
# Gesture Recognition System - Frontend Startup Script
# This script helps you start both the backend and frontend together
echo "🚀 Starting Gesture Recognition System with React Frontend"
echo "=========================================================="
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed. Please install Node.js first."
exit 1
fi
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3 first."
exit 1
fi
# Install frontend dependencies if needed
if [ ! -d "frontend/node_modules" ]; then
echo "📦 Installing frontend dependencies..."
cd frontend
npm install
cd ..
fi
# Install backend dependencies if needed
if [ ! -d "node_modules" ]; then
echo "📦 Installing backend dependencies..."
npm install
fi
echo ""
echo "🔧 Starting Backend Server (Node.js + WebSocket)..."
echo " Server will run on http://localhost:3001"
echo ""
# Start the backend server in the background
npm start &
BACKEND_PID=$!
# Wait a moment for the backend to start
sleep 3
echo ""
echo "🎨 Starting React Frontend..."
echo " Frontend will run on http://localhost:3000"
echo ""
# Start the frontend
cd frontend
npm start &
FRONTEND_PID=$!
echo ""
echo "✅ Both servers are starting up!"
echo ""
echo "📊 Backend API: http://localhost:3001"
echo "🎨 Frontend UI: http://localhost:3000"
echo ""
echo "🔍 To start gesture recognition:"
echo " 1. Open http://localhost:3000 in your browser"
echo " 2. Go to the Configure page to set up gesture mappings"
echo " 3. Run: python run.py --camera-index 1 --web-stream"
echo ""
echo "📝 Options:"
echo " --web-stream: Stream camera to web frontend (no OpenCV window)"
echo " --no-display: Run in headless mode"
echo " --camera-index N: Use camera device N (default: 1)"
echo ""
echo "Press Ctrl+C to stop both servers"
# Function to cleanup on exit
cleanup() {
echo ""
echo "🛑 Stopping servers..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
echo "✅ Servers stopped"
exit 0
}
# Set up signal handlers
trap cleanup SIGINT SIGTERM
# Wait for either process to exit
wait