A full-stack web application for human action recognition using TensorFlow/Keras and React.
- Upload images to classify human actions
- Real-time prediction using a trained TensorFlow model
- Modern React frontend with Vite
- Flask backend API
- 15 action classes: Sitting, Drinking, Calling, Sleeping, Clapping, Dancing, Cycling, Laughing, Eating, Fighting, Listening to music, Running, and more
HAR/
├── app.py # Flask backend API
├── Model2.h5/ # Trained TensorFlow model
├── requirements.txt # Python dependencies
├── package.json # Node.js dependencies
├── vite.config.js # Vite configuration
├── index.html # React app entry point
├── src/
│ ├── main.jsx # React entry point
│ ├── App.jsx # Main React component
│ ├── App.css # Component styles
│ └── index.css # Global styles
└── templates/ # (Legacy Flask templates - not used in React version)
pip install -r requirements.txtnpm installUsing npm script (requires concurrently):
npm install # Install concurrently if not already installed
npm start # Starts both backend and frontendUsing start scripts:
- Windows: Double-click
start.bator runstart.batin terminal - Linux/Mac: Run
chmod +x start.sh && ./start.sh
Terminal 1 - Start Flask Backend:
python app.pyBackend will run on http://localhost:5000
Terminal 2 - Start React Frontend:
npm run devFrontend will run on http://localhost:3000
Upload an image to get human action prediction.
Request:
- Method: POST
- Content-Type: multipart/form-data
- Body:
image(file)
Response:
{
"success": true,
"prediction": "Sitting"
}Health check endpoint.
Response:
{
"status": "healthy",
"model_loaded": true
}- Accuracy: ~70%
- Dataset: Kaggle Human Action Recognition Dataset
- Input Size: 224x224 RGB images
- Output: 15 action classes
- Frontend: React 18, Vite
- Backend: Flask, Flask-CORS
- ML: TensorFlow/Keras
- Image Processing: PIL/Pillow, NumPy
- Frontend runs on port 3000 (configured in
vite.config.js) - Backend runs on port 5000 (configured in
app.py) - Vite proxy is configured to forward
/predictand/healthrequests to the backend
© 2024 Vaibhav Soni | All rights reserved.