CoolFace
Apppublic

PrathikshaR7/CycleGAN

sourceHugging Faceupdated 9mo agoView on Hugging Face
1likes
App README

Photo2Sketch CycleGAN

A deep learning project that converts photographs to artistic sketches using CycleGAN architecture. This project supports image upload, video processing, and live camera feed for real-time sketch generation.

Features

  • —Photo to Sketch Conversion: Transform uploaded photos into artistic sketches
  • —Video Processing: Convert entire videos to sketch animations
  • —Live Camera Feed: Real-time sketch generation from webcam
  • —Dual-Stage Processing: Enhanced quality with color transfer and post-processing
  • —Firebase Authentication: Secure user authentication system
  • —Responsive Web Interface: Modern UI built with Flask and Bootstrap

Quick Start

Local Development

  1. 1.Clone the repository
  2. 2.Install dependencies: pip install -r requirements.txt
  3. 3.Run the application: python app.py HEAD
  4. 4.Open http://localhost:7860 in your browser
  1. 1.Open http://localhost:5000 in your browser 678f30c (Hugging_Face)

Docker Deployment

  1. 1.Build the Docker image: docker build -t photo2sketch . HEAD
  2. 2.Run the container: docker run -p 7860:7860 photo2sketch
  1. 1.Run the container: docker run -p 5000:5000 photo2sketch 678f30c (Hugging_Face)

Model Architecture

This project uses CycleGAN with the following components:

  • —Generator networks for photo→sketch and sketch→photo conversion
  • —Discriminator networks for adversarial training
  • —Color transfer pipeline for enhanced output quality
  • —Post-processing for photorealistic results

Requirements

  • —Python 3.10+
  • —PyTorch 2.0+
  • —OpenCV
  • —Flask
  • —Firebase Admin SDK
  • —CUDA (optional, for GPU acceleration)

File Structure

├── app.py                 # Main Flask application
├── models/               # CycleGAN model definitions
├── checkpoints/          # Pre-trained model weights
├── static/              # Static assets (CSS, JS, images)
├── templates/           # HTML templates
├── uploads/             # User uploaded files
├── requirements.txt     # Python dependencies
└── Dockerfile          # Docker configuration

Usage

  1. 1.Upload Photo: Select an image file and upload it for sketch conversion
  2. 2.Process Video: Upload a video file to convert all frames to sketches
  3. 3.Live Camera: Enable webcam for real-time sketch generation
  4. 4.Download Results: Save generated sketches and processed media

Model Performance

The model achieves high-quality sketch generation with:

  • —Structural preservation of original photos
  • —Artistic sketch-style rendering
  • —Fast inference speed suitable for real-time applications

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • —Based on CycleGAN architecture from Zhu et al.
  • —Uses pre-trained models for photo-to-sketch conversion
  • —Enhanced with color transfer and post-processing pipelines