| title | colorFrom | colorTo | sdk | sdk_version | app_file | pinned |
|---|---|---|---|---|---|---|
PersonaGen |
blue |
green |
gradio |
5.44.1 |
app.py |
true |
PersonaGen is a generative AI project that creates synthetic human portraits using Stable Diffusion and the 🤗 Hugging Face Diffusers library.
The system takes a text prompt as input and produces high-quality faces that can be customised by age, gender, expression, and artistic style.
👉 Try the live demo on Hugging Face Spaces: PersonaGen Demo
- Generate photorealistic or stylised portraits from text prompts
- Control over age, gender, mood, and style
- Artistic filters: watercolour, comic, cyberpunk, oil painting
- Deployed with Gradio on Hugging Face Spaces
- Python 3.10+ – primary language for AI development and web app.
- PyTorch – tensor computations, model execution on CPU/GPU. (pytorch.org)
- Hugging Face Diffusers – Stable Diffusion pipelines, model management, inference. (github.com/huggingface/diffusers)
- Gradio – easy-to-use UI for running ML models in a web browser. (gradio.app)
- PEFT (Parameter-Efficient Fine-Tuning) – apply LoRA weights to enhance models with minimal compute. (huggingface.co/docs/peft)
- LoRA Weights for Stable Diffusion – optional fine-tuning for realistic facial features.
- Additional Python Libraries:
numpy– numerical operations.Pillow– image creation and manipulation.torchvision– image preprocessing and utilities.ipywidgets– interactive notebook controls (optional for demos).
PersonaGen/
├── app.py # Gradio interface (main entry point)
├── requirements.txt # Dependencies for Hugging Face Space
├── README.md # Project documentation
├── .gitignore
├── examples/ # Pre-generated demo portraits
│ ├── woman_blonde.png
│ ├── smiling_kid.png
└── young_male.png
Follow these steps to run PersonaGen locally or on Hugging Face Spaces:
- Clone the repository
git clone https://github.com/yourusername/PersonaGen.git
cd PersonaGen- Install dependencies
pip install -r requirements.txt- Run the app
python app.py- Open the app in your browser
-
Visit the local URL shown in the console (usually http://127.0.0.1:7860).
-
Or use the Share link provided by Gradio to access the app remotely.
- Optional: Enable LoRA for enhanced faces
- Install PEFT if not already installed:
pip install peft- Check the "Apply Face LoRA" box in the interface to use the LoRA weights.
Clone the repository and install dependencies:
git clone https://github.com/yourusername/PersonaGen.git
cd PersonaGen
pip install -r requirements.txtOr using conda:
conda create -n personagen python=3.10 -y
conda activate personagen
pip install -r requirements.txtpython app.pyEnsure the peft library is installed (pip install peft). Enable the "Apply Face LoRA" checkbox in the app for enhanced facial features.
- Launch the app with:
python app.py- Enter a text prompt in the Gradio interface. Example prompts:
Modern portrait of woman with blonde hair, smiling, realisticStylised portrait of a young boy smiling, beach background, watercolor stylePortrait of a young male character, smiling, vibrant colours
- Adjust settings:
- Steps: number of diffusion steps (default: 25)
- Style: choose from photorealistic, watercolor, comic, cyberpunk, oil painting
- LoRA: check the box to enhance facial features (requires
peft)
- Generated images are displayed in the web UI and can be downloaded by clicking the image download icon.
| Prompt | Result with LoRA | Result without LoRA |
|---|---|---|
| Modern portrait of woman with blonde hair, smiling, realistic | ![]() |
![]() |
| Stylised portrait of a young boy smiling, beach background, watercolor | ![]() |
![]() |
Caption: Images in the "Result with LoRA" column include LoRA fine-tuning for enhanced facial details, while "Result without LoRA" shows the base Stable Diffusion output.
Notes:
- Steps = number of diffusion steps (default: 25).
- CPU runtime varies depending on hardware (around 451.4s).
- LoRA enhancement requires peft and is optional.
This version is compact, public-repo friendly, and highlights LoRA, CPU optimization, and basic usage instructions.
-
Stable Diffusion v1.5 – base text-to-image model
https://huggingface.co/runwayml/stable-diffusion-v1-5 -
LCM LoRA for SD v1.5 – optional LoRA weights for enhanced faces
https://huggingface.co/latent-consistency/lcm-lora-sdv1-5



