abdulwaqar/Synthetic_Data_Generation
DCGAN Face Generator
A Gradio web application for generating synthetic 64×64 RGB face images using a trained DCGAN Generator.
Project structure
dcgan-face-generator/
├── app.py
├── generator.py
├── generator.pth
├── requirements.txt
└── README.mdModel
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:
generator.pthFor example, if your Colab training saved:
checkpoints/generator_epoch_200.pthcopy that file and rename it to:
generator.pthDo 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:
pip install -r requirements.txtStart the application:
python app.pyGradio will provide a local URL.
Google Colab checkpoint
If your checkpoint is currently in Colab, download it with:
from google.colab import files
files.download("checkpoints/generator_epoch_200.pth")Then rename the downloaded file to:
generator.pthand place it beside app.py.
Hugging Face Spaces
Create a new Gradio Space and upload:
app.py
generator.py
generator.pth
requirements.txt
README.mdThe 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).
