Downloads ยท 30 days
0
Keerthi-sc/gru
gru is a machine learning model from Keerthi-sc. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
An end-to-end Deep Convolutional GAN (DCGAN) implementation for generating handwritten digits using PyTorch, trained on the MNIST dataset and deployed with Flask.
Downloads ยท 30 days
0
Access
Public
Updated Feb 7, 2026
Repo size
17.9 MB
Likes
0
Public
Click a slice to open those files.
.h517.3 MB ยท 90%
From the Hugging Face model README
An end-to-end Deep Convolutional GAN (DCGAN) implementation for generating handwritten digits using PyTorch, trained on the MNIST dataset and deployed with Flask.
gan/
โโโ app.py # Flask web application
โโโ train.py # GAN training script
โโโ generate.py # Inference script
โโโ gan_model.py # GAN model architecture
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ checkpoints/ # Saved model checkpoints
โ โโโ generator_final.pth
โโโ samples/ # Training sample outputs
โ โโโ samples_epoch_*.png
โโโ generated/ # Generated digit outputs
โโโ templates/ # HTML templates
โ โโโ index.html
โ โโโ error.html
โโโ static/ # Static assets
โโโ css/
โ โโโ style.css
โโโ js/
โโโ app.js
pip install -r requirements.txt
python train.py --epochs 100 --batch-size 128
Training parameters:
--epochs: Number of training epochs (default: 100)--batch-size: Batch size (default: 128)--lr: Learning rate (default: 0.0002)--latent-dim: Latent space dimension (default: 100)python app.py
Then open http://localhost:5000 in your browser.
# Generate 16 digits and save as grid
python generate.py --num-samples 16 --save-grid --show
# Generate individual images
python generate.py --num-samples 64 --save-individual --output-dir ./my_digits
# Interactive mode
python generate.py
| Endpoint | Method | Description |
|---|---|---|
/ | GET | Main web interface |
/generate?num=N | GET | Generate N digits (1-64) |
/generate-single | GET | Generate single digit |
/api/status | GET | Check model status |
/health | GET | Health check |
# Generate 9 digits
curl "http://localhost:5000/generate?num=9"
# Generate single digit
curl "http://localhost:5000/generate-single"
# Check status
curl "http://localhost:5000/api/status"
The training script saves:
samples/samples_epoch_*.png)checkpoints/gan_checkpoint_epoch_*.pth)checkpoints/generator_final.pth)checkpoints/training_history.png)Edit gan_model.py to change:
self.main in Generator class)self.main in Discriminator class)latent_dim parameter)Edit train.py or use command-line arguments:
python train.py --epochs 200 --batch-size 64 --lr 0.0001
After 50-100 epochs, the generator should produce:
checkpoints/ directoryMIT License