Rolls-Royce / README.md
fantaxy's picture
Update README.md
5f357ae verified

A newer version of the Gradio SDK is available: 5.46.0

Upgrade
metadata
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

  1. 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
  2. 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
  3. 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
  4. 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:

  1. Loads the base FLUX.1-dev model with bfloat16 precision for memory efficiency
  2. Applies the Rolls-Royce LoRA weights for specialized car generation
  3. Processes user prompts with specified parameters
  4. Saves generated images automatically with metadata
  5. 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)๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ „๋ฌธ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค.

์ฃผ์š” ๊ธฐ๋Šฅ

  1. ๊ณ ๊ธ‰ AI ๋ชจ๋ธ ํ†ตํ•ฉ

    • Black Forest Labs์˜ ์ตœ์ฒจ๋‹จ FLUX.1-dev ํ™•์‚ฐ ํŒŒ์ดํ”„๋ผ์ธ ํ™œ์šฉ
    • ๋กค์Šค๋กœ์ด์Šค ์ฐจ๋Ÿ‰ ์ „์šฉ์œผ๋กœ ํ•™์Šต๋œ ์ปค์Šคํ…€ LoRA ์–ด๋Œ‘ํ„ฐ(seawolf2357/flux-lora-car-rolls-royce) ์ ์šฉ
    • CUDA GPU ๊ฐ€์† ๋ฐ CPU ํด๋ฐฑ ์ง€์›์œผ๋กœ ํญ๋„“์€ ํ˜ธํ™˜์„ฑ ์ œ๊ณต
  2. ์˜๊ตฌ ์ด๋ฏธ์ง€ ์ €์žฅ

    • ์ƒ์„ฑ๋œ ๋ชจ๋“  ์ด๋ฏธ์ง€๋ฅผ ๊ณ ์œ ํ•œ ํƒ€์ž„์Šคํƒฌํ”„์™€ UUID๋กœ ์ž๋™ ์ €์žฅ
    • ํ”„๋กฌํ”„ํŠธ์™€ ์ƒ์„ฑ ์‹œ๊ฐ„์„ ์ถ”์ ํ•˜๋Š” ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ํŒŒ์ผ ์œ ์ง€
    • ์ด์ „์— ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€๋ฅผ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐค๋Ÿฌ๋ฆฌ ๋ทฐ ์ œ๊ณต
  3. ์‚ฌ์šฉ์ž ์นœํ™”์  ์ธํ„ฐํŽ˜์ด์Šค

    • Gradio๋ฅผ ์‚ฌ์šฉํ•œ ์ง๊ด€์ ์ธ ์›น ๊ธฐ๋ฐ˜ ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์ถ•
    • ์ƒ์„ฑ(Generation)๊ณผ ๊ฐค๋Ÿฌ๋ฆฌ(Gallery) ๋‘ ๊ฐœ์˜ ์ฃผ์š” ํƒญ ์ œ๊ณต
    • ๋‹ค์–‘ํ•œ ๋กค์Šค๋กœ์ด์Šค ๋ชจ๋ธ์„ ๊ณ ๊ธ‰์Šค๋Ÿฌ์šด ํ™˜๊ฒฝ์—์„œ ๋ณด์—ฌ์ฃผ๋Š” ์˜ˆ์ œ ํ”„๋กฌํ”„ํŠธ ํฌํ•จ
  4. ๋งž์ถคํ˜• ์ƒ์„ฑ ๋งค๊ฐœ๋ณ€์ˆ˜

    • ์‹œ๋“œ ์ œ์–ด: ์žฌํ˜„์„ฑ์„ ์œ„ํ•œ ๋ฌด์ž‘์œ„ํ™” ๋˜๋Š” ์ˆ˜๋™ ์‹œ๋“œ ์„ค์ • ์˜ต์…˜
    • ์ด๋ฏธ์ง€ ํฌ๊ธฐ: ์กฐ์ • ๊ฐ€๋Šฅํ•œ ๋„ˆ๋น„์™€ ๋†’์ด (์ตœ๋Œ€ 1024x1024 ํ”ฝ์…€)
    • ๊ฐ€์ด๋˜์Šค ์Šค์ผ€์ผ: ํ”„๋กฌํ”„ํŠธ ์ค€์ˆ˜ ์ •๋„ ์ œ์–ด (0.0-10.0)
    • ์ถ”๋ก  ๋‹จ๊ณ„: ๋…ธ์ด์ฆˆ ์ œ๊ฑฐ ๋‹จ๊ณ„ ์ˆ˜ (1-50)
    • LoRA ์Šค์ผ€์ผ: ๋กค์Šค๋กœ์ด์Šค ํŠนํ™” ์ ์‘ ๊ฐ•๋„ (0.0-1.0)

๊ธฐ์ˆ ์  ๊ตฌํ˜„

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ•ต์‹ฌ ๊ธฐ์ˆ ์„ ํ™œ์šฉํ•ฉ๋‹ˆ๋‹ค:

  • ๋”ฅ๋Ÿฌ๋‹ ์—ฐ์‚ฐ์„ ์œ„ํ•œ PyTorch
  • ํ™•์‚ฐ ๋ชจ๋ธ ํŒŒ์ดํ”„๋ผ์ธ์„ ์œ„ํ•œ Diffusers ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  • ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์œ„ํ•œ Gradio
  • ์ตœ์ ํ™”๋œ GPU ์‚ฌ์šฉ์„ ์œ„ํ•œ Spaces GPU ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ (120์ดˆ ์‹œ๊ฐ„ ์ œํ•œ)

์ƒ์„ฑ ํ”„๋กœ์„ธ์Šค:

  1. ๋ฉ”๋ชจ๋ฆฌ ํšจ์œจ์„ฑ์„ ์œ„ํ•ด bfloat16 ์ •๋ฐ€๋„๋กœ ๊ธฐ๋ณธ FLUX.1-dev ๋ชจ๋ธ ๋กœ๋“œ
  2. ์ „๋ฌธ ์ž๋™์ฐจ ์ƒ์„ฑ์„ ์œ„ํ•œ ๋กค์Šค๋กœ์ด์Šค LoRA ๊ฐ€์ค‘์น˜ ์ ์šฉ
  3. ์ง€์ •๋œ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉ์ž ํ”„๋กฌํ”„ํŠธ ์ฒ˜๋ฆฌ
  4. ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€๋ฅผ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์™€ ํ•จ๊ป˜ ์ž๋™ ์ €์žฅ
  5. ์ƒˆ๋กœ์šด ์ƒ์„ฑ๋ฌผ๋กœ ๊ฐค๋Ÿฌ๋ฆฌ ๋ทฐ ์—…๋ฐ์ดํŠธ

์‚ฌ์šฉ ์˜ˆ์‹œ

ํฌํ•จ๋œ ์˜ˆ์ œ๋“ค์€ ๋‹ค์–‘ํ•œ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค:

  • ๊ฑด์ถ•์  ๋ฐฐ๊ฒฝ์˜ ํด๋ž˜์‹ ๋กค์Šค๋กœ์ด์Šค ๋ชจ๋ธ
  • ๋„์‹œ ํ™˜๊ฒฝ์˜ ํ˜„๋Œ€์  ์ฐจ๋Ÿ‰
  • ์ž์—ฐ ํ’๊ฒฝ ์†์˜ ๋Ÿญ์…”๋ฆฌ SUV
  • ์—ญ์‚ฌ์  ๋งฅ๋ฝ์˜ ๋นˆํ‹ฐ์ง€ ์ž๋™์ฐจ
  • ๋…์ ์ ์ธ ์žฅ์†Œ์˜ ๊ณ ์„ฑ๋Šฅ ๋ชจ๋ธ

๊ฐ ํ”„๋กฌํ”„ํŠธ์—๋Š” LoRA ์ ์‘์„ ํšจ๊ณผ์ ์œผ๋กœ ํ™œ์„ฑํ™”ํ•˜๊ธฐ ์œ„ํ•œ [trigger] ํ‚ค์›Œ๋“œ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.