Spaces:
Running
on
Zero
A newer version of the Gradio SDK is available:
5.46.0
title: Rolls-Royce FLUX LoRA
emoji: ๐
colorFrom: yellow
colorTo: green
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
I'll create comprehensive documentation for this Flux LoRA Rolls-Royce image generation code in both English and Korean.
English Documentation
Flux LoRA Rolls-Royce Image Generator
This application is a specialized image generation tool that uses the FLUX.1-dev diffusion model with a custom LoRA (Low-Rank Adaptation) fine-tuned specifically for generating high-quality Rolls-Royce automobile images.
Key Features
Advanced AI Model Integration
- Utilizes the state-of-the-art FLUX.1-dev diffusion pipeline from Black Forest Labs
- Incorporates a custom LoRA adapter (
seawolf2357/flux-lora-car-rolls-royce
) specifically trained on Rolls-Royce vehicles - Supports both CUDA GPU acceleration and CPU fallback for broader compatibility
Persistent Image Storage
- Automatically saves all generated images with unique timestamps and UUIDs
- Maintains a metadata file tracking prompts and generation times
- Provides a gallery view for browsing previously generated images
User-Friendly Interface
- Built with Gradio for an intuitive web-based interface
- Features two main tabs: Generation and Gallery
- Includes pre-written example prompts showcasing various Rolls-Royce models in luxurious settings
Customizable Generation Parameters
- Seed Control: Option for randomization or manual seed setting for reproducibility
- Image Dimensions: Adjustable width and height (up to 1024x1024 pixels)
- Guidance Scale: Controls how closely the image follows the prompt (0.0-10.0)
- Inference Steps: Number of denoising steps (1-50)
- LoRA Scale: Strength of the Rolls-Royce-specific adaptation (0.0-1.0)
Technical Implementation
The application leverages several key technologies:
- PyTorch for deep learning operations
- Diffusers library for the diffusion model pipeline
- Gradio for the web interface
- Spaces GPU decorator for optimized GPU usage (120-second duration limit)
The generation process:
- Loads the base FLUX.1-dev model with bfloat16 precision for memory efficiency
- Applies the Rolls-Royce LoRA weights for specialized car generation
- Processes user prompts with specified parameters
- Saves generated images automatically with metadata
- Updates the gallery view with new creations
Example Use Cases
The included examples demonstrate various scenarios:
- Classic Rolls-Royce models in architectural settings
- Modern vehicles in urban environments
- Luxury SUVs in natural landscapes
- Vintage cars in historical contexts
- High-performance models in exclusive locations
Each prompt includes the [trigger]
keyword to activate the LoRA adaptation effectively.
ํ๊ธ ์ค๋ช ์
Flux LoRA ๋กค์ค๋ก์ด์ค ์ด๋ฏธ์ง ์์ฑ๊ธฐ
์ด ์ ํ๋ฆฌ์ผ์ด์ ์ FLUX.1-dev ํ์ฐ ๋ชจ๋ธ๊ณผ ๋กค์ค๋ก์ด์ค ์๋์ฐจ ์ด๋ฏธ์ง ์์ฑ์ ํนํ๋ ์ปค์คํ LoRA(Low-Rank Adaptation)๋ฅผ ์ฌ์ฉํ๋ ์ ๋ฌธ ์ด๋ฏธ์ง ์์ฑ ๋๊ตฌ์ ๋๋ค.
์ฃผ์ ๊ธฐ๋ฅ
๊ณ ๊ธ AI ๋ชจ๋ธ ํตํฉ
- Black Forest Labs์ ์ต์ฒจ๋จ FLUX.1-dev ํ์ฐ ํ์ดํ๋ผ์ธ ํ์ฉ
- ๋กค์ค๋ก์ด์ค ์ฐจ๋ ์ ์ฉ์ผ๋ก ํ์ต๋ ์ปค์คํ
LoRA ์ด๋ํฐ(
seawolf2357/flux-lora-car-rolls-royce
) ์ ์ฉ - CUDA GPU ๊ฐ์ ๋ฐ CPU ํด๋ฐฑ ์ง์์ผ๋ก ํญ๋์ ํธํ์ฑ ์ ๊ณต
์๊ตฌ ์ด๋ฏธ์ง ์ ์ฅ
- ์์ฑ๋ ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ณ ์ ํ ํ์์คํฌํ์ UUID๋ก ์๋ ์ ์ฅ
- ํ๋กฌํํธ์ ์์ฑ ์๊ฐ์ ์ถ์ ํ๋ ๋ฉํ๋ฐ์ดํฐ ํ์ผ ์ ์ง
- ์ด์ ์ ์์ฑ๋ ์ด๋ฏธ์ง๋ฅผ ํ์ํ ์ ์๋ ๊ฐค๋ฌ๋ฆฌ ๋ทฐ ์ ๊ณต
์ฌ์ฉ์ ์นํ์ ์ธํฐํ์ด์ค
- Gradio๋ฅผ ์ฌ์ฉํ ์ง๊ด์ ์ธ ์น ๊ธฐ๋ฐ ์ธํฐํ์ด์ค ๊ตฌ์ถ
- ์์ฑ(Generation)๊ณผ ๊ฐค๋ฌ๋ฆฌ(Gallery) ๋ ๊ฐ์ ์ฃผ์ ํญ ์ ๊ณต
- ๋ค์ํ ๋กค์ค๋ก์ด์ค ๋ชจ๋ธ์ ๊ณ ๊ธ์ค๋ฌ์ด ํ๊ฒฝ์์ ๋ณด์ฌ์ฃผ๋ ์์ ํ๋กฌํํธ ํฌํจ
๋ง์ถคํ ์์ฑ ๋งค๊ฐ๋ณ์
- ์๋ ์ ์ด: ์ฌํ์ฑ์ ์ํ ๋ฌด์์ํ ๋๋ ์๋ ์๋ ์ค์ ์ต์
- ์ด๋ฏธ์ง ํฌ๊ธฐ: ์กฐ์ ๊ฐ๋ฅํ ๋๋น์ ๋์ด (์ต๋ 1024x1024 ํฝ์ )
- ๊ฐ์ด๋์ค ์ค์ผ์ผ: ํ๋กฌํํธ ์ค์ ์ ๋ ์ ์ด (0.0-10.0)
- ์ถ๋ก ๋จ๊ณ: ๋ ธ์ด์ฆ ์ ๊ฑฐ ๋จ๊ณ ์ (1-50)
- LoRA ์ค์ผ์ผ: ๋กค์ค๋ก์ด์ค ํนํ ์ ์ ๊ฐ๋ (0.0-1.0)
๊ธฐ์ ์ ๊ตฌํ
์ ํ๋ฆฌ์ผ์ด์ ์ ๋ค์๊ณผ ๊ฐ์ ํต์ฌ ๊ธฐ์ ์ ํ์ฉํฉ๋๋ค:
- ๋ฅ๋ฌ๋ ์ฐ์ฐ์ ์ํ PyTorch
- ํ์ฐ ๋ชจ๋ธ ํ์ดํ๋ผ์ธ์ ์ํ Diffusers ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- ์น ์ธํฐํ์ด์ค๋ฅผ ์ํ Gradio
- ์ต์ ํ๋ GPU ์ฌ์ฉ์ ์ํ Spaces GPU ๋ฐ์ฝ๋ ์ดํฐ (120์ด ์๊ฐ ์ ํ)
์์ฑ ํ๋ก์ธ์ค:
- ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ์ํด bfloat16 ์ ๋ฐ๋๋ก ๊ธฐ๋ณธ FLUX.1-dev ๋ชจ๋ธ ๋ก๋
- ์ ๋ฌธ ์๋์ฐจ ์์ฑ์ ์ํ ๋กค์ค๋ก์ด์ค LoRA ๊ฐ์ค์น ์ ์ฉ
- ์ง์ ๋ ๋งค๊ฐ๋ณ์๋ก ์ฌ์ฉ์ ํ๋กฌํํธ ์ฒ๋ฆฌ
- ์์ฑ๋ ์ด๋ฏธ์ง๋ฅผ ๋ฉํ๋ฐ์ดํฐ์ ํจ๊ป ์๋ ์ ์ฅ
- ์๋ก์ด ์์ฑ๋ฌผ๋ก ๊ฐค๋ฌ๋ฆฌ ๋ทฐ ์ ๋ฐ์ดํธ
์ฌ์ฉ ์์
ํฌํจ๋ ์์ ๋ค์ ๋ค์ํ ์๋๋ฆฌ์ค๋ฅผ ๋ณด์ฌ์ค๋๋ค:
- ๊ฑด์ถ์ ๋ฐฐ๊ฒฝ์ ํด๋์ ๋กค์ค๋ก์ด์ค ๋ชจ๋ธ
- ๋์ ํ๊ฒฝ์ ํ๋์ ์ฐจ๋
- ์์ฐ ํ๊ฒฝ ์์ ๋ญ์ ๋ฆฌ SUV
- ์ญ์ฌ์ ๋งฅ๋ฝ์ ๋นํฐ์ง ์๋์ฐจ
- ๋ ์ ์ ์ธ ์ฅ์์ ๊ณ ์ฑ๋ฅ ๋ชจ๋ธ
๊ฐ ํ๋กฌํํธ์๋ LoRA ์ ์์ ํจ๊ณผ์ ์ผ๋ก ํ์ฑํํ๊ธฐ ์ํ [trigger]
ํค์๋๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.