Seamless-Texture / README.md
Maikeu Locatelli
Update SDK version to 6.1.0 in README and requirements.txt to prevent mismatch with HF Spaces. Enhance image handling in model_handler.py to sanitize metadata from providers, improving compatibility with Gradio.
49d3665
|
Raw
History Blame Contribute Delete
6.86 kB
---
title: Gokaygokay Flux Seamless Texture LoRA
emoji:
colorFrom: purple
colorTo: blue
sdk: gradio
# Evita bug conhecido do 6.0.0 onde painéis/API/MCP podem ficar em branco no Spaces.
sdk_version: 6.1.0
app_file: app.py
pinned: false
---
# Flux Seamless Texture LoRA
Generate seamless textures using the Flux LoRA model. This Space provides a modern interface with advanced controls, presets, batch generation, gallery, and MCP (Model Context Protocol) integration.
## Features
- 🎨 **Advanced Generation Controls**: Fine-tune guidance scale, steps, seed, dimensions, and more
- 🎯 **Presets**: Pre-configured settings for common texture types (wood, fabric, metal, stone, etc.)
- 📦 **Batch Generation**: Generate multiple textures at once with progress tracking
- 🖼️ **Gallery**: View and download all generated textures
- 📜 **History**: Track and reuse previous generation parameters
- 🔌 **MCP Integration**: Access via Model Context Protocol for AI tool integration
- 🎨 **Modern UI**: Clean, responsive interface built with Gradio 6
## Quick Start
1. Enter a prompt describing the texture you want
2. Adjust parameters or select a preset
3. Click "Generate" to create your texture
4. View results in the Gallery tab
5. Access history in the History tab
## Usage
### Basic Generation
1. Go to the **Generate** tab
2. Enter your prompt (e.g., "seamless wood texture, natural grain")
3. Optionally select a preset from the dropdown
4. Adjust parameters as needed:
- **Guidance Scale**: Controls how closely the model follows the prompt (1-20)
- **Inference Steps**: Number of denoising steps (10-100)
- **Seed**: Random seed for reproducibility (-1 for random)
- **Width/Height**: Image dimensions (must be multiples of 8)
5. Click **Generate**
### Using Presets
Select a preset from the dropdown to automatically apply optimized settings:
- Wood Texture
- Fabric Texture
- Metal Texture
- Stone Texture
- Brick Texture
- Leather Texture
- Concrete Texture
- Marble Texture
### Batch Generation
1. Go to the **Batch Generate** tab
2. Enter multiple prompts, one per line
3. Set common parameters
4. Click **Generate Batch**
5. Monitor progress and view results
### Gallery
- View all generated textures in a grid
- Click **Refresh Gallery** to update
- Download all images as a ZIP file
### History
- View generation history with timestamps
- Reuse parameters from previous generations
- Export history data
## MCP Integration
This Space supports Model Context Protocol (MCP) for integration with AI tools.
### Configuration
See `docs/MCP.md` for detailed setup instructions.
**Quick Setup:**
1. Add to your MCP client configuration:
```json
{
"mcpServers": {
"flux-texture-lora": {
"url": "https://huggingface.co/spaces/gokaygokay/Flux-Seamless-Texture-LoRA/gradio_api/mcp/",
"type": "http"
}
}
}
```
2. Restart your MCP client
3. Use tools like `generate_texture`, `get_presets`, etc.
### Available MCP Tools
- `generate_texture` - Generate a texture with parameters
- `generate_batch_textures` - Generate multiple textures
- `get_presets` - List available presets
- `get_history` - Get generation history
- `download_image` - Get image information
See `docs/MCP.md` for complete documentation.
## Parameters
### Generation Parameters
- **Prompt**: Text description of the desired texture
- **Negative Prompt**: What to avoid in generation
- **Guidance Scale** (1-20): How closely to follow the prompt
- **Inference Steps** (10-100): Number of denoising steps
- **Seed** (-1 or positive): Random seed for reproducibility
- **Width/Height** (256-2048, multiple of 8): Image dimensions
- **CFG Scale** (1-20): Classifier-free guidance scale
- **LoRA Strength** (0-2): Strength of LoRA adaptation
## Installation
### Hugging Face Spaces (recomendado)
- **Entry point**: `app.py` (já configurado no YAML do topo deste README).
- **Secrets**: se o modelo for privado, adicione `HF_TOKEN` em *Settings → Secrets* do Space.
- **Storage**: se você habilitar *Persistent Storage*, os arquivos gerados serão gravados em `/data` automaticamente (fallback para o diretório do repo se `/data` não existir).
- **Queue**: o app roda com `queue()` habilitado para suportar inferência demorada sem travar o servidor.
### Desenvolvimento local (opcional)
1. Clone the repository:
```bash
git clone https://huggingface.co/spaces/gokaygokay/Flux-Seamless-Texture-LoRA
cd Flux-Seamless-Texture-LoRA
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables (optional):
```bash
cp .env.example .env
# Edit .env with your settings
```
4. Run the application:
```bash
python app.py
```
## Project Structure
```
.
├── app.py # Main Gradio application
├── requirements.txt # Python dependencies
├── config/
│ └── settings.py # Configuration settings
├── src/
│ ├── model_handler.py # Model management
│ ├── image_processor.py # Image processing
│ ├── presets.py # Texture presets
│ ├── utils.py # Utility functions
│ └── mcp_server.py # MCP server implementation
├── tests/ # Unit tests
├── docs/ # Documentation
└── assets/ # Assets and examples
```
## Documentation
- [API Documentation](docs/API.md) - Complete API reference
- [MCP Integration](docs/MCP.md) - MCP setup and usage
- [Gradio 6 Migration](docs/GRADIO6_MIGRATION.md) - Migration details
## Development
### Running Tests
```bash
pytest tests/
```
### Code Style
- Type hints required
- Google-style docstrings
- Follow PEP 8
## Troubleshooting
### Common Issues
**Generation fails:**
- Check that dimensions are multiples of 8
- Verify prompt is not empty
- Ensure parameters are within valid ranges
**MCP not working:**
- Verify Space URL is correct
- Check that MCP is enabled
- Ensure client configuration is correct
**Images not saving:**
- Check write permissions
- Verify OUTPUT_DIR exists
- Check disk space
## Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request
## License
See the repository for license information.
## Acknowledgments
- Flux model by Black Forest Labs
- Gradio for the UI framework
- Hugging Face for hosting
## Changelog
### Version 2.0.0 (Current)
- ✅ Migrated to Gradio 6
- ✅ Added MCP integration
- ✅ Modernized UI with tabs
- ✅ Added batch generation
- ✅ Added gallery and history
- ✅ Added presets system
- ✅ Comprehensive documentation
### Version 1.0.0
- Initial release with basic generation
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference