File size: 6,864 Bytes
e788617
 
 
 
 
 
49d3665
 
e788617
 
 
 
f0d9a3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84e3f61
 
 
 
 
 
 
 
f0d9a3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e788617
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
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