CoolFace
Apppublic

abdulwaqar/Synthetic_Data_Generation

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

DCGAN Face Generator

A Gradio web application for generating synthetic 64×64 RGB face images using a trained DCGAN Generator.

Project structure

text
dcgan-face-generator/
├── app.py
├── generator.py
├── generator.pth
├── requirements.txt
└── README.md

Model

The Generator uses the same DCGAN architecture used during training:

  • —Latent dimension: 100
  • —Output size: 64×64
  • —Output channels: 3 (RGB)
  • —Batch normalization
  • —ReLU activations
  • —Tanh output

Important: add your trained model

generator.pth is your trained Generator checkpoint.

Copy the checkpoint from Google Colab into this project and rename it:

text
generator.pth

For example, if your Colab training saved:

text
checkpoints/generator_epoch_200.pth

copy that file and rename it to:

text
generator.pth

Do not use a random or empty .pth file. The application needs the actual trained weights.

Local installation

Create and activate a virtual environment, then run:

bash
pip install -r requirements.txt

Start the application:

bash
python app.py

Gradio will provide a local URL.

Google Colab checkpoint

If your checkpoint is currently in Colab, download it with:

python
from google.colab import files

files.download("checkpoints/generator_epoch_200.pth")

Then rename the downloaded file to:

text
generator.pth

and place it beside app.py.

Hugging Face Spaces

Create a new Gradio Space and upload:

text
app.py
generator.py
generator.pth
requirements.txt
README.md

The Space will install the dependencies from requirements.txt and run app.py.

Important limitation

This is a standard DCGAN, not a conditional GAN. Therefore, the application does not provide a "Male" or "Female" generation control. It generates faces from random latent noise.

If class-controlled generation is required later, the project should be extended to a Conditional GAN (cGAN).