fal / README.md
bibibi12345's picture
initial test
c5f0b8c
metadata
title: SeedDream v4 Edit
emoji: 🎨
colorFrom: purple
colorTo: pink
sdk: docker
app_port: 7860
pinned: false
license: mit

SeedDream v4 - AI Image Generator & Editor

A web-based interface for AI-powered image generation and editing using ByteDance's SeedDream v4 models via the FAL API. This application is containerized and ready for deployment on Hugging Face Spaces.

Features

  • 🎨 Dual Mode: Switch between Image Editing and Text-to-Image generation
  • πŸ“€ Support for multiple image uploads (up to 10 images for editing)
  • πŸ”— URL-based image input support
  • βš™οΈ Customizable generation settings with smart dimension detection
  • πŸ”’ Safety checker disabled for unrestricted creativity
  • 🐳 Docker containerized for easy deployment
  • πŸš€ Hugging Face Spaces compatible

Quick Start

Local Development

  1. Clone the repository

    git clone <your-repo-url>
    cd fal_ui
    
  2. Install dependencies

    # Install Python dependencies
    pip install -r requirements.txt
    
  3. Run the application

    python app.py
    

    The app will be available at http://localhost:7860

Docker Deployment

  1. Build the Docker image

    docker build -t seedream-editor .
    
  2. Run the container

    docker run -p 7860:7860 seedream-editor
    

Deployment on Hugging Face Spaces

Method 1: Direct Deployment

  1. Go to Hugging Face Spaces
  2. Click "Create new Space"
  3. Choose "Docker" as the SDK
  4. Upload all project files
  5. The application is ready to deploy - users will enter their API key directly in the interface

Method 2: Using Git

  1. Create a new Space on Hugging Face

  2. Clone your space locally:

    git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
    cd YOUR_SPACE_NAME
    
  3. Copy all project files to the space directory

  4. Create a .gitignore file:

    __pycache__/
    *.pyc
    .env
    
  5. Push to Hugging Face:

    git add .
    git commit -m "Initial commit"
    git push
    

Configuration

API Key

The FAL API key is entered directly in the web interface:

  • Enter your API key in the "API Configuration" section at the top of the page
  • The key is stored locally in your browser (localStorage)
  • Get your API key from fal.ai

Model Selection

Choose between two powerful models:

  • Image Edit Mode: fal-ai/bytedance/seedream/v4/edit - Edit existing images with prompts
  • Text-to-Image Mode: fal-ai/bytedance/seedream/v4/text-to-image - Generate new images from text

Environment Variables

  • PORT: Port number (default: 7860)
  • SPACE_ID: Automatically set by Hugging Face Spaces

Project Structure

fal_ui/
β”œβ”€β”€ app.py                 # Flask application
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ Dockerfile            # Docker configuration
β”œβ”€β”€ templates/
β”‚   └── index.html        # Frontend interface
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ style.css         # Styling
β”‚   └── script.js         # Frontend logic
└── README.md             # Documentation

Features Overview

Image Input

  • File Upload: Select multiple images from your device
  • URL Input: Paste image URLs directly
  • Preview: Visual preview of uploaded images

Generation Settings

  • Image Size: Preset sizes or custom dimensions (1024-4096px)
  • Number of Generations: Control output quantity
  • Seed: Optional seed for reproducible results
  • Safety Checker: Toggle content filtering

API Integration

  • Automatic API key management
  • Real-time progress logging
  • Error handling and status updates

Security Notes

  • Never expose your FAL API key in client-side code
  • The application uses server-side proxy for API calls
  • API keys can be stored in environment variables or Hugging Face secrets

Troubleshooting

Common Issues

  1. API Key Error

    • Ensure you've entered your FAL API key in the interface
    • Check if the key has proper permissions
    • Get a new key from fal.ai if needed
  2. Docker Build Fails

    • Verify all files are in the correct directories
    • Check Docker daemon is running
  3. Hugging Face Deployment Issues

    • Ensure Dockerfile is present
    • Check logs in the Space settings

Support

For issues related to:

License

This project is provided as-is for educational and development purposes.

Acknowledgments