Skip to content

Mccranky83/Hack-TX-2025

Repository files navigation

PrivacyWear - Privacy by Fashion

A modern full-stack application showcasing "privacy-by-fashion" concept. This app demonstrates how clothing can be designed to hide from YOLO computer vision detection, featuring both a Next.js frontend and Python-based YOLO detection backend.

๐Ÿš€ Quick Start

Frontend (Next.js)

  1. Install dependencies:

    npm install
  2. Start development server:

    npm run dev
  3. Open your browser: Navigate to http://localhost:3000

Backend (YOLO Detection)

  1. Start the YOLO server:

    ./start_py.sh
  2. Or manually:

    cd object-detection
    source venv/bin/activate
    python webrtc_server.py
  3. Test detection:

    cd object-detection
    source venv/bin/activate
    python test_inference_endpoint.py

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 15 with App Router
  • TypeScript for type safety
  • Tailwind CSS for styling
  • shadcn/ui for components
  • Lucide React for icons
  • Stripe for payment processing

Backend

  • Python 3.12+ with virtual environment
  • YOLOv8 (Ultralytics) for object detection
  • OpenCV for computer vision
  • aiohttp for async web server
  • PyTorch for ML framework
  • Pillow for image processing

๐Ÿ“ฑ Features

๐Ÿ  Hero/Dashboard Page

  • Marketing-focused landing page
  • Clear value proposition for privacy-by-fashion
  • Call-to-action buttons for testing and shopping
  • Privacy level explanations
  • Responsive design

๐Ÿงช Test Your Privacy Page

  • Image Upload: Upload photos to test detection
  • Camera Capture: Use webcam for real-time testing
  • Real YOLO Detection: Live object detection using YOLOv8
  • Results Display: Clear PASS/FAIL indicators with bounding boxes
  • Confidence Scores: Shows detection confidence levels
  • Annotated Images: Visual results with detection overlays

๐Ÿ›๏ธ Shop Page

  • Product Grid: Browse privacy-focused clothing
  • Filtering: Filter by category, privacy level, search
  • Product Details: Modal with size/color selection
  • Shopping Cart: Local storage-based cart
  • Mock Checkout: Simulated checkout process

๐Ÿ” Sign In Page

  • Clean authentication interface
  • Demo credentials provided
  • Privacy policy links

๐ŸŽจ Design Features

  • Dark Theme: Sleek purple/slate gradient design
  • Mobile-First: Fully responsive across all devices
  • Accessibility: ARIA labels, keyboard navigation
  • Performance: Optimized images, lazy loading
  • Modern UI: Clean, professional interface

๐Ÿ“Š Privacy Levels

  • Basic (60-70%): Subtle anti-detection patterns
  • Enhanced (80-85%): Advanced pattern disruption
  • Maximum (90-95%): Cutting-edge invisibility tech

๐Ÿ”ง API Endpoints

Frontend APIs (Next.js)

  • POST /api/test-design - Test clothing design with AI
  • POST /api/generate-image - Generate realistic images using Gemini
  • POST /api/inference - Run YOLO detection on images
  • GET /api/products - Product catalog
  • POST /api/cart - Cart management
  • POST /api/checkout - Stripe checkout

Backend APIs (Python)

  • POST /inference - YOLO object detection endpoint
  • WebSocket /ws - Real-time camera feed
  • GET /health - Server health check

๐Ÿ Python Backend Setup

Prerequisites

  • Python 3.12+ installed
  • Virtual environment support

Installation

The Python backend uses a virtual environment located in object-detection/venv/:

# Automatic setup (recommended)
./start_py.sh

# Manual setup
cd object-detection
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Dependencies

  • ultralytics: YOLOv8 model
  • opencv-python: Computer vision
  • aiohttp: Async web server
  • torch/torchvision: ML framework
  • pillow: Image processing
  • numpy: Numerical computing

Running the Backend

# Start YOLO server (port 8080)
cd object-detection
source venv/bin/activate
python webrtc_server.py

# Test detection
python test_inference_endpoint.py

# Run camera demo
python webrtc_demo.py

๐Ÿ“ Project Structure

โ”œโ”€โ”€ src/                    # Next.js frontend
โ”‚   โ”œโ”€โ”€ app/               # App Router pages
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx       # Hero/Dashboard page
โ”‚   โ”‚   โ”œโ”€โ”€ test/          # Privacy testing page
โ”‚   โ”‚   โ”œโ”€โ”€ shop/          # Product catalog & cart
โ”‚   โ”‚   โ”œโ”€โ”€ design/        # Design interface
โ”‚   โ”‚   โ”œโ”€โ”€ checkout/      # Checkout flow
โ”‚   โ”‚   โ””โ”€โ”€ api/           # API routes
โ”‚   โ”œโ”€โ”€ components/        # React components
โ”‚   โ”œโ”€โ”€ contexts/          # React contexts
โ”‚   โ”œโ”€โ”€ lib/               # Utilities
โ”‚   โ””โ”€โ”€ types/             # TypeScript definitions
โ”œโ”€โ”€ object-detection/       # Python backend
โ”‚   โ”œโ”€โ”€ venv/              # Virtual environment
โ”‚   โ”œโ”€โ”€ webrtc_server.py   # YOLO detection server
โ”‚   โ”œโ”€โ”€ webrtc_demo.py     # Camera demo
โ”‚   โ”œโ”€โ”€ test_*.py          # Test scripts
โ”‚   โ”œโ”€โ”€ requirements.txt   # Python dependencies
โ”‚   โ””โ”€โ”€ yolov8n.pt         # YOLO model weights
โ”œโ”€โ”€ public/                # Static assets
โ”œโ”€โ”€ start_py.sh           # Python setup script
โ””โ”€โ”€ package.json          # Node.js dependencies

๐Ÿš€ Deployment

This app is ready for deployment on:

  • Vercel (recommended for Next.js)
  • Netlify
  • Railway
  • Any platform supporting Node.js

๐ŸŽฏ Hackathon Demo Flow

  1. Landing Page: Show the concept and value proposition
  2. Design Interface: Create custom privacy-focused clothing designs
  3. Test Privacy: Demonstrate real YOLO detection with live results
  4. Shop Collection: Browse products and add to cart
  5. Checkout: Complete the purchase flow with Stripe integration

๐Ÿ”ง Environment Setup

Required Environment Variables

Create a .env.local file in the root directory:

# Gemini API Configuration
GEMINI_API_KEY=your_gemini_api_key_here

# WebRTC Server Configuration
WEBRTC_SERVER_URL=http://localhost:8080

# Next.js Configuration
NEXT_PUBLIC_BASE_URL=http://localhost:3000

# Stripe Configuration
STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
STRIPE_SECRET_KEY=your_stripe_secret_key

Development Workflow

  1. Start Python backend: ./start_py.sh
  2. Start Next.js frontend: npm run dev
  3. Test integration: Visit /test page for live detection
  4. Design clothing: Visit /design page for design interface

๐Ÿ”ฎ Future Enhancements

  • Advanced AI Models: Integration with more sophisticated detection models
  • User Authentication: Complete user management system
  • Real-time Processing: Live video stream analysis
  • Mobile App: React Native mobile application
  • Product Reviews: User feedback and rating system
  • Size Guide: AI-powered size recommendations
  • Social Features: Share designs and privacy scores
  • Cloud Deployment: Scalable cloud infrastructure

๐Ÿ› Troubleshooting

Common Issues

Python Backend Issues:

  • Virtual environment not found: Run ./start_py.sh to create it
  • Package installation fails: Ensure Python 3.12+ is installed
  • Port 8080 in use: Change port in webrtc_server.py

Frontend Issues:

  • API calls fail: Ensure Python backend is running on port 8080
  • Environment variables: Check .env.local file exists
  • Build errors: Run npm install to update dependencies

Detection Issues:

  • No detections: Check image quality and lighting
  • Low confidence: Try different angles or lighting
  • Server errors: Check Python backend logs

Built for TX2025 Hackathon ๐Ÿ†

Protecting your privacy through fashion

About

HackTX 25 Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •