library_name: diffusers
tags:
- text-to-image
- stable-diffusion
base_model: stabilityai/stable-diffusion-xl-base-1.0
license: apache-2.0
pipeline_tag: text-to-image
DreamBooth LoRA Training with Stable Diffusion XL on Trump Thumbs Up Images
This repository contains instructions and code for training a DreamBooth LoRA model using Stable Diffusion XL on a dataset of images featuring Donald Trump giving a thumbs up gesture. The trained model can be used to generate high-quality images of Trump showing thumbs up in various contexts.
Sample Images
Here are a few sample images generated by the trained model:
- A high quality picture of Trump showing thumbs up in a busy street of India, detailed, sharp focus*
- An intricately detailed digital painting of Donald Trump giving a thumbs up at a taco restaurant. The background includes colorful decor and a bustling atmosphere with people enjoying their meals.*
- A high-quality photo of Donald Trump giving a thumbs up on a sunny beach. The scene includes clear blue water, white sand, and Trump in casual beachwear. The image is detailed, with Trump’s smiling face and the vibrant beach setting in sharp focus.*.
Requirements
The script requires Python 3.9 and several Python packages including PyTorch, Hugging Face Transformers, Diffusers, and Accelerate. Additional dependencies are listed in the requirements_sdxl.txt
file.
Installation
To get started, clone the repository and navigate to the project directory. Install the required packages using pip and the provided requirements_sdxl.txt
file. Log in to the Hugging Face Hub using the huggingface-cli login
command.
Usage
To train the model, prepare a dataset of images featuring Donald Trump giving a thumbs up gesture and place them in a directory. Run the training script train_dreambooth_lora_sdxl.py
with the appropriate command-line arguments specifying the pretrained model, instance data directory, output directory, and various training hyperparameters.
After training, load the trained LoRA weights and use the DiffusionPipeline
class from the Diffusers library to generate images. Provide a prompt describing the desired image, such as "A high quality picture of Trump showing the thumbs up in Paris detailed, sharp focus". The generated image will be saved to the specified output directory.
API Server
SDXL_API_Server contains the server side code containing the below information :
Image Generation Endpoint:
/generate_image
: Accepts POST requests with prompts to generate Trump thumbs up images.- Users provide prompts describing desired image contexts.
- Images are generated using a pre-trained model.
API Key Authentication:
- Ensures presence of API key for authorization.
- Rejects unauthorized requests.
API Key Usage Tracking:
- Tracks API key usage count.
/api_key_usage
endpoint retrieves usage count.
The Generated Output in postman:
Results
The generated images will be saved in the specified output directory, showcasing Trump giving a thumbs up gesture in different contexts based on the provided prompts.