Aguilar Elizondo commited on
Commit
467eea4
ยท
1 Parent(s): e43f3cc

Add training pair upload and preview functionality to Custom Training tab

Browse files
Files changed (1) hide show
  1. app.py +71 -1
app.py CHANGED
@@ -180,8 +180,78 @@ with gr.Blocks(title="๐Ÿ›๏ธ Architecture AI Enhancer") as demo:
180
 
181
  ## โš ๏ธ Important Note
182
 
183
- **Training is not available on this HF Space** due to computational requirements. However, you can train locally and deploy your custom model!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  ## ๐Ÿš€ What is LoRA Training?
186
 
187
  LoRA (Low-Rank Adaptation) allows you to fine-tune the AI with just 10-50 image pairs to learn:
 
180
 
181
  ## โš ๏ธ Important Note
182
 
183
+ **Training execution is not available on this HF Space** due to computational requirements. However, you can:
184
+ 1. Upload and preview your training pairs below
185
+ 2. Download the guide to train locally
186
+ 3. Deploy your custom model
187
+ """)
188
+
189
+ gr.Markdown("---")
190
+
191
+ # Training pair upload section
192
+ gr.Markdown("""
193
+ ## ๐Ÿ“ธ Preview Training Pairs
194
+
195
+ Upload example pairs to visualize what you'll train with:
196
+ """)
197
+
198
+ with gr.Row():
199
+ with gr.Column():
200
+ gr.Markdown("### Input Image (Before)")
201
+ training_input = gr.Image(label="Input Render", type="pil")
202
+
203
+ with gr.Column():
204
+ gr.Markdown("### Target Image (After)")
205
+ training_target = gr.Image(label="Target Enhanced", type="pil")
206
+
207
+ with gr.Row():
208
+ preview_btn = gr.Button("๐Ÿ‘๏ธ Preview Training Pair", variant="secondary")
209
+ clear_btn = gr.Button("๐Ÿ—‘๏ธ Clear", variant="secondary")
210
+
211
+ training_preview = gr.Gallery(
212
+ label="Training Pair Preview",
213
+ columns=2,
214
+ rows=1,
215
+ height="auto"
216
+ )
217
+
218
+ def preview_training_pair(input_img, target_img):
219
+ """Preview training pair side by side"""
220
+ if input_img is None or target_img is None:
221
+ return []
222
+ return [input_img, target_img]
223
 
224
+ def clear_training():
225
+ """Clear training inputs"""
226
+ return None, None, []
227
+
228
+ preview_btn.click(
229
+ fn=preview_training_pair,
230
+ inputs=[training_input, training_target],
231
+ outputs=training_preview
232
+ )
233
+
234
+ clear_btn.click(
235
+ fn=clear_training,
236
+ inputs=[],
237
+ outputs=[training_input, training_target, training_preview]
238
+ )
239
+
240
+ gr.Markdown("""
241
+ ---
242
+
243
+ ## ๐Ÿ’ก Tips for Good Training Pairs
244
+
245
+ - **Consistency**: Use similar compositions between input and target
246
+ - **Quality**: High-resolution images (512x512 minimum)
247
+ - **Variety**: Include different views and lighting conditions
248
+ - **Alignment**: Input and target should show the same scene
249
+ - **Target Quality**: Ensure targets represent your desired style accurately
250
+
251
+ ---
252
+ """)
253
+
254
+ gr.Markdown("""
255
  ## ๐Ÿš€ What is LoRA Training?
256
 
257
  LoRA (Low-Rank Adaptation) allows you to fine-tune the AI with just 10-50 image pairs to learn: