--- 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** ```bash git clone cd fal_ui ``` 2. **Install dependencies** ```bash # Install Python dependencies pip install -r requirements.txt ``` 3. **Run the application** ```bash python app.py ``` The app will be available at `http://localhost:7860` ### Docker Deployment 1. **Build the Docker image** ```bash docker build -t seedream-editor . ``` 2. **Run the container** ```bash docker run -p 7860:7860 seedream-editor ``` ## Deployment on Hugging Face Spaces ### Method 1: Direct Deployment 1. Go to [Hugging Face Spaces](https://huggingface.co/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: ```bash 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: ```bash 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](https://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](https://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: - FAL API: Visit [fal.ai documentation](https://fal.ai/docs) - Hugging Face Spaces: Check [Hugging Face documentation](https://huggingface.co/docs/hub/spaces) ## License This project is provided as-is for educational and development purposes. ## Acknowledgments - Powered by [FAL.ai](https://fal.ai) - ByteDance SeedDream v4 model - Deployed on [Hugging Face Spaces](https://huggingface.co/spaces)