metadata
title: SeedDream v4 Editor - Optimized
emoji: 🎨
colorFrom: purple
colorTo: pink
sdk: docker
app_port: 7860
pinned: false
license: mit
SeedDream v4 Editor - Optimized
ByteDance SeedDream v4 图像编辑器的优化版本。
🚀 架构特性
模块化设计
- 清晰的分层架构:Flask应用 + API模块 + FAL客户端
- 同步API模式:使用FAL queue模式,避免复杂的异步处理
- 类型安全:正确处理FAL SDK的状态对象(Queued/InProgress/Completed)
部署自动化
- GitHub Actions:自动同步到 Hugging Face Spaces
- 环境管理:统一的环境变量配置
- 健康监控:内置健康检查端点
🛠️ 本地开发
# 安装依赖
pip install -r requirements.txt
# 运行应用
python app.py
A web-based interface for AI-powered image generation and editing using ByteDance's SeedDream v4 models via the FAL API.
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
Clone the repository
git clone <your-repo-url> cd fal_uiInstall dependencies
# Install Python dependencies pip install -r requirements.txtRun the application
python app.pyThe app will be available at
http://localhost:7860
Docker Deployment
Build the Docker image
docker build -t seedream-editor .Run the container
docker run -p 7860:7860 seedream-editor
Deployment on Hugging Face Spaces
Method 1: Direct Deployment
- Go to Hugging Face Spaces
- Click "Create new Space"
- Choose "Docker" as the SDK
- Upload all project files
- The application is ready to deploy - users will enter their API key directly in the interface
Method 2: Using Git
Create a new Space on Hugging Face
Clone your space locally:
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME cd YOUR_SPACE_NAMECopy all project files to the space directory
Create a
.gitignorefile:__pycache__/ *.pyc .envPush 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 (main entry point)
├── api/
│ ├── routes.py # API endpoints
│ └── fal_client.py # FAL API client wrapper
├── monitoring.py # Logging and monitoring
├── 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
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
Docker Build Fails
- Verify all files are in the correct directories
- Check Docker daemon is running
Hugging Face Deployment Issues
- Ensure Dockerfile is present
- Check logs in the Space settings
Support
For issues related to:
- FAL API: Visit fal.ai documentation
- Hugging Face Spaces: Check Hugging Face documentation
License
This project is provided as-is for educational and development purposes.
Acknowledgments
- Powered by FAL.ai
- ByteDance SeedDream v4 model
- Deployed on Hugging Face Spaces