loop-detector-app

πŸŽ₯ Loop Detector App

This project captures webcam video in the browser, detects loops (e.g., a pink or white thread) between two hands using computer vision (MediaPipe + OpenCV), and displays the result with a dummy login UI.


✨ Features

User: admin

Password: admin


πŸ”§ Project Structure

loop-detector-app/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app.py
β”‚   β”œβ”€β”€ auth.py
β”‚   β”œβ”€β”€ detect.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ runtime.txt
β”‚   β”œβ”€β”€ Procfile
β”‚   └── README.md
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html
β”‚   └── README.md
β”œβ”€β”€ deploy.sh
└── README.md

πŸš€ Deployment on Render

The Loop Detector App backend is hosted on Render, ensuring easy deployment of the Flask API. It processes image frames, detects loops, and returns results in real-time.

πŸ”§ Steps:

  1. Push code to GitHub
  2. Set up a Render service for the backend
  3. Configure environment variables (API keys, authentication tokens)
  4. Deploy and monitor in Render’s dashboard

⏳ AWS Lambda + EventBridge Integration (Keep Server Awake)

To prevent the Render service from spinning down due to inactivity, we use AWS Lambda + Amazon EventBridge.

πŸ”Ή Lambda Setup:

  1. Create a Lambda function in AWS
  2. Write a Python script to send periodic requests:
import requests

def lambda_handler(event, context):
    url = "https://loop-detector-app-1.onrender.com/"
    try:
        response = requests.get(url)
        return {"status": response.status_code, "message": "Ping successful"}
    except Exception as e:
        return {"error": str(e)}
  1. Schedule execution using EventBridge (every 15 minutes):
    • Navigate to Amazon EventBridge
    • Click β€œCreate Rule” β†’ Name it keep-render-awake
    • Set schedule type to fixed rate (e.g., rate(15 minutes))
    • Choose AWS Lambda as the target
    • Save and enable the rule

πŸ’‘ Benefits:

βœ… Keeps the Render app active without manual intervention
βœ… Uses free-tier AWS Lambda, minimizing costs
βœ… Ensures smooth user experience without unexpected downtime


πŸ–₯️ Frontend (HTML + JavaScript)

Option 1: Open Directly

start frontend/index.html

Option 2: Serve with Python

cd frontend
python3 -m http.server 8000

Visit:
http://localhost:8000


πŸ” Demo Login


πŸ“„ License

This software is proprietary.

Unauthorized use, reproduction, or redistribution is prohibited without written permission from the author.

Β© 2025 Aimee L. Ramirez. Developer identity: @aimeelramirez. All rights reserved.