Amrith2k6 commited on
Commit
1a9302d
·
verified ·
1 Parent(s): c2cdda7

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +10 -0
  2. app.py +788 -0
  3. packages.txt +2 -0
Dockerfile ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,788 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py - Photo Album Creator for Hugging Face
2
+ import gradio as gr
3
+ import pandas as pd
4
+ from datetime import datetime
5
+ import json
6
+ import random
7
+
8
+ # Cell 3: Enhanced Photo Album Creator Class - With Footwear Color Formatting
9
+ class EnhancedPhotoAlbumCreator:
10
+ """Enhanced AI Photo Album Creation with dynamic saree options and footwear color formatting"""
11
+
12
+ def __init__(self):
13
+ # Predefined prefix (invisible in UI but appears in final prompt)
14
+ self.prefix = "In Cinematic 16:9 wide frame from ground level, HD quality, cinematic scene"
15
+
16
+ # Subject description
17
+ self.subject = "Indian actress Nayanthara with White skinned and tied back ponytail black hairs, and hourglass curve body shape,eyes focus on camera with gentle smile"
18
+
19
+ # Saree-specific options (shown only when Saree is selected)
20
+ self.saree_style_options = [
21
+ "Traditional Silk Saree",
22
+ "Kanchipuram Silk Saree",
23
+ "Banarasi Silk Saree",
24
+ "Cotton Saree",
25
+ "Chiffon Saree",
26
+ "Georgette Saree",
27
+ "Linen Saree",
28
+ "Transparent Saree"
29
+ ]
30
+
31
+ self.saree_fabric_options = [
32
+ "Pure Silk",
33
+ "Art Silk",
34
+ "Cotton",
35
+ "Chiffon",
36
+ "Georgette",
37
+ "Linen",
38
+ "Soft Silk"
39
+ ]
40
+
41
+ self.pallu_style_options = [
42
+ "with her saree's pallu elegantly dropped over her left shoulder",
43
+ "with her saree pallu gracefully draped over left shoulder",
44
+ "with traditional saree pallu falling over left shoulder",
45
+ "with silk saree pallu cascading over left shoulder",
46
+ "with embroidered saree pallu draped over left shoulder",
47
+ "with contrast pallu artistically arranged over left shoulder",
48
+ "with heavy embellished pallu resting on left shoulder"
49
+ ]
50
+
51
+
52
+ # Background visibility options
53
+ self.background_visibility_options = [
54
+ "with background clearly visible behind her",
55
+ "with background prominently featured",
56
+ "with depth of field showing background in focus",
57
+ "with background elements visible around her",
58
+ "with the background fully visible behind the subject",
59
+ "with subject in foreground, background clearly visible"
60
+ ]
61
+
62
+ # Composition options
63
+ self.composition_options = [
64
+ "subject positioned to show full background",
65
+ "wide shot revealing entire background",
66
+ "subject placed off-center to showcase background",
67
+ "subject framed to not obscure background elements"
68
+ ]
69
+
70
+ # TopWear Pattern Options
71
+ self.topwear_pattern_options = [
72
+ "Plain",
73
+ "Striped Pattern",
74
+ "Floral Print",
75
+ "Polka Dots",
76
+ "Checkered",
77
+ "Geometric Pattern"
78
+ ]
79
+
80
+ # Color Options
81
+ self.color_options = [
82
+ "Violet",
83
+ "Orange",
84
+ "Royal Blue",
85
+ "Turquoise",
86
+ "Green",
87
+ "Red",
88
+ "Pink",
89
+ "White"
90
+ ]
91
+
92
+ # TopWear Neck Design Options
93
+ self.neck_design_options = [
94
+ "Classic V-Neck",
95
+ "Deep Plunging V-Neck",
96
+ "V-Neck with Button Placket",
97
+ "Crossover V-Neck",
98
+ "V-Neck with Collar",
99
+ "Round Neck",
100
+ "Scoop Neck",
101
+ "Boat Neck",
102
+ "Square Neck",
103
+ "Sweetheart Neckline"
104
+ ]
105
+
106
+ # TopWear Style Options
107
+ self.topwear_style_options = [
108
+ "Full Sleeve",
109
+ "Half Sleeve",
110
+ "Sleeveless",
111
+ "Off-Shoulder"
112
+ ]
113
+
114
+ # TopWear Type Options
115
+ self.topwear_type_options = [
116
+ "Polo T-Shirt",
117
+ "Casual Shirt",
118
+ "Crop Top",
119
+ "Designer Blouse"
120
+ ]
121
+
122
+ # BottomWear Pattern Options
123
+ self.bottomwear_pattern_options = [
124
+ "Plain",
125
+ "Striped Pattern",
126
+ "Floral Print",
127
+ "Polka Dots",
128
+ "Checkered",
129
+ "Geometric Pattern"
130
+ ]
131
+
132
+ # BottomWear Type Options
133
+ self.bottomwear_type_options = [
134
+ "Pant",
135
+ "Denim Pant",
136
+ "Skirt",
137
+ "Mini-Skirt",
138
+ "Midi",
139
+ "Saree" # This option triggers saree-specific fields
140
+ ]
141
+
142
+ # Footwear Options
143
+ self.footwear_options = [
144
+ "Heels",
145
+ "Sneakers",
146
+ "Sandals",
147
+ "Pumps",
148
+ "Wedges",
149
+ "Flats"
150
+ ]
151
+
152
+ # Pose Standing Options
153
+ self.pose_standing_options = [
154
+ "above on Concrete floor",
155
+ "above on Marble floor",
156
+ "above on Mud floor"
157
+ ]
158
+
159
+ # Pose Sitting Options
160
+ self.pose_sitting_options = [
161
+ "above on White marble bench",
162
+ "above on Wood bench"
163
+ ]
164
+
165
+ # UPDATED Gesture Options
166
+ self.gesture_options = [
167
+ "Simple",
168
+ "Rests her chin delicately on her hand",
169
+ "Adjusting her backhairs by one hand",
170
+ "placed her one hand on her hip",
171
+ "placed her both hands on her hip"
172
+ ]
173
+
174
+ # Background Options
175
+ self.background_options = [
176
+ "TajMahal",
177
+ "Eiffel Tower",
178
+ "Rajasthan Palace",
179
+ "Tower of Pisa",
180
+ "Roman Colosseum",
181
+ "Statue of Liberty",
182
+ "Machu Picchu",
183
+ "Pyramids of Giza",
184
+ "Sydney Opera House",
185
+ "Christ the Redeemer",
186
+ "Sagrada Familia",
187
+ "Coconut Tropical Beach",
188
+ "Turquoise Sea shore",
189
+ "Tropical Waterfalls",
190
+ "Modern Shopping Mall",
191
+ "House Living room",
192
+ "House Portico with Hanging pots",
193
+ "House Balcony with Hanging pots",
194
+ "Kerala Style Terracotta House"
195
+ ]
196
+
197
+ def is_saree_bottom(self, bottom_type):
198
+ """Check if bottom type is Saree (exact match only)"""
199
+ return bottom_type == "Saree"
200
+
201
+ def generate_prompt(self, top_pattern, top_color, neck_design, top_style, top_type,
202
+ bottom_color, bottom_pattern, bottom_type, footwear,
203
+ pose_type, pose_location, gesture, background,
204
+ background_visibility, composition,
205
+ saree_style=None, saree_fabric=None, pallu_style=None):
206
+ """
207
+ Generate complete text prompt with dynamic saree options and footwear color formatting
208
+ """
209
+ # Construct the topwear description
210
+ topwear_desc = f"{top_pattern} {top_color} {neck_design} {top_style} {top_type}"
211
+
212
+ # Construct bottomwear description based on type
213
+ if self.is_saree_bottom(bottom_type):
214
+ # For saree, use saree-specific options
215
+ bottomwear_desc = f"{bottom_color} {bottom_pattern} {saree_style if saree_style else 'silk saree'}"
216
+ blouse_desc = ""
217
+ else:
218
+ # For all other bottom wear, use regular description
219
+ bottomwear_desc = f"{bottom_color} {bottom_pattern} {bottom_type}"
220
+ blouse_desc = ""
221
+
222
+ # FOOTWEAR FORMATTING: top_color + "color" + footwear
223
+ # Example: "Violet color Heels"
224
+ footwear_desc = f"{top_color} color {footwear}"
225
+
226
+ # Outfit part with formatted footwear
227
+ if blouse_desc:
228
+ outfit_part = f"wearing {topwear_desc}, {blouse_desc}, {bottomwear_desc}, {footwear_desc}"
229
+ else:
230
+ outfit_part = f"wearing {topwear_desc}, {bottomwear_desc}, {footwear_desc}"
231
+
232
+ # Add saree-specific feature ONLY if bottom type is exactly "Saree"
233
+ saree_feature = ""
234
+ if self.is_saree_bottom(bottom_type) and pallu_style:
235
+ saree_feature = f", {pallu_style}"
236
+
237
+ # Handle pose based on selection
238
+ if pose_type == "Standing":
239
+ pose_part = f"Standing {pose_location}"
240
+ else: # Sitting
241
+ pose_part = f"Sitting {pose_location}"
242
+
243
+ # Gesture part
244
+ gesture_part = f", {gesture}"
245
+
246
+ # Background with visibility control
247
+ background_part = f"in front of {background}, {background_visibility}, {composition}"
248
+
249
+ # Combine all parts
250
+ full_prompt = f"{self.prefix}, {self.subject}, {outfit_part}{saree_feature}, {pose_part}{gesture_part}, {background_part}"
251
+
252
+ return full_prompt
253
+
254
+ def reset_form(self):
255
+ """Return default values for all dropdowns"""
256
+ return (
257
+ self.topwear_pattern_options[0],
258
+ self.color_options[0],
259
+ self.neck_design_options[0],
260
+ self.topwear_style_options[0],
261
+ self.topwear_type_options[0],
262
+ self.color_options[0],
263
+ self.bottomwear_pattern_options[0],
264
+ self.bottomwear_type_options[0],
265
+ self.footwear_options[0],
266
+ "Standing",
267
+ self.pose_standing_options[0],
268
+ self.gesture_options[0],
269
+ self.background_options[0],
270
+ self.background_visibility_options[0],
271
+ self.composition_options[0],
272
+ self.saree_style_options[0],
273
+ self.saree_fabric_options[0],
274
+ self.pallu_style_options[0]
275
+ )
276
+
277
+ # Initialize the enhanced photo album creator
278
+ creator = EnhancedPhotoAlbumCreator()
279
+ print("✅ Enhanced Photo Album Creator initialized successfully!")
280
+
281
+ # Cell 4: Create Enhanced Gradio UI with Dynamic Saree Options and Footwear Color
282
+ def create_enhanced_photo_album_app():
283
+ """Create the Enhanced Photo Album Creation interface with dynamic saree fields"""
284
+
285
+ with gr.Blocks(title="📸 Enhanced AI Photo Album Creator") as demo:
286
+ gr.Markdown("""
287
+ # 📸 Enhanced AI Photo Album Creation Studio
288
+
289
+ Create stunning AI-generated photos with complete control over subject and background.
290
+
291
+ ### ✨ Special Features:
292
+ - **Complete Saree Customization** - When Saree is selected, additional saree-specific options appear!
293
+ - **Color-Coordinated Footwear** - Footwear automatically uses: **`[Top Color] color [Footwear]`**
294
+ * Example: `Violet color Heels`
295
+ """)
296
+
297
+ with gr.Tabs():
298
+ # Tab 1: Main Creation Interface
299
+ with gr.TabItem("🎨 Create Photo", id=0):
300
+ with gr.Row():
301
+ with gr.Column(scale=1):
302
+ # Photo Upload Section
303
+ gr.Markdown("### 📤 Step 1: Upload Photo")
304
+ input_image = gr.Image(
305
+ label="Upload Reference Photo (Optional)",
306
+ type="pil",
307
+ height=200
308
+ )
309
+
310
+ gr.Markdown("---")
311
+ gr.Markdown("### 👗 Step 2: Top Wear Customization")
312
+ gr.Markdown("*🎨 Your topwear color will be used for footwear*")
313
+
314
+ # Top Wear Customization
315
+ with gr.Group():
316
+ with gr.Row():
317
+ top_pattern = gr.Dropdown(
318
+ choices=creator.topwear_pattern_options,
319
+ label="🎨 Top Pattern",
320
+ value=creator.topwear_pattern_options[0]
321
+ )
322
+
323
+ top_color = gr.Dropdown(
324
+ choices=creator.color_options,
325
+ label="🌈 Top Color (used for footwear)",
326
+ value=creator.color_options[0]
327
+ )
328
+
329
+ with gr.Row():
330
+ neck_design = gr.Dropdown(
331
+ choices=creator.neck_design_options,
332
+ label="👚 Neck Design",
333
+ value=creator.neck_design_options[0]
334
+ )
335
+
336
+ top_style = gr.Dropdown(
337
+ choices=creator.topwear_style_options,
338
+ label="👕 Top Style",
339
+ value=creator.topwear_style_options[0]
340
+ )
341
+
342
+ top_type = gr.Dropdown(
343
+ choices=creator.topwear_type_options,
344
+ label="👔 Top Type",
345
+ value=creator.topwear_type_options[0]
346
+ )
347
+
348
+ gr.Markdown("---")
349
+ gr.Markdown("### 👖 Step 3: Bottom Wear Customization")
350
+ gr.Markdown("*✨ Select **Saree** to see additional saree customization options*")
351
+
352
+ # Bottom Wear Basic Options
353
+ with gr.Group():
354
+ with gr.Row():
355
+ bottom_color = gr.Dropdown(
356
+ choices=creator.color_options,
357
+ label="🌈 Bottom Color",
358
+ value=creator.color_options[0]
359
+ )
360
+
361
+ bottom_pattern = gr.Dropdown(
362
+ choices=creator.bottomwear_pattern_options,
363
+ label="🎨 Bottom Pattern",
364
+ value=creator.bottomwear_pattern_options[0]
365
+ )
366
+
367
+ bottom_type = gr.Dropdown(
368
+ choices=creator.bottomwear_type_options,
369
+ label="👖 Bottom Type",
370
+ value=creator.bottomwear_type_options[0]
371
+ )
372
+
373
+ # Saree-specific fields (initially hidden)
374
+ with gr.Column(visible=False) as saree_fields:
375
+ gr.Markdown("---")
376
+ gr.Markdown("### 👘 Saree Customization Options")
377
+
378
+ with gr.Row():
379
+ saree_style = gr.Dropdown(
380
+ choices=creator.saree_style_options,
381
+ label="🧵 Saree Style",
382
+ value=creator.saree_style_options[0]
383
+ )
384
+
385
+ saree_fabric = gr.Dropdown(
386
+ choices=creator.saree_fabric_options,
387
+ label="🧶 Saree Fabric",
388
+ value=creator.saree_fabric_options[0]
389
+ )
390
+
391
+ with gr.Row():
392
+ pallu_style = gr.Dropdown(
393
+ choices=creator.pallu_style_options,
394
+ label="📿 Pallu Style",
395
+ value=creator.pallu_style_options[0]
396
+ )
397
+
398
+ gr.Markdown("---")
399
+ gr.Markdown("### 👟 Step 4: Footwear")
400
+ gr.Markdown("*✨ Format: **`[Top Color] color [Footwear]`** (e.g., Violet color Heels)*")
401
+
402
+ # Footwear Type
403
+ footwear = gr.Dropdown(
404
+ choices=creator.footwear_options,
405
+ label="Footwear Type",
406
+ value=creator.footwear_options[0]
407
+ )
408
+
409
+ # Display final footwear format
410
+ footwear_preview = gr.Textbox(
411
+ label="Final Footwear (Preview)",
412
+ value=f"{top_color.value} color {footwear.value}",
413
+ interactive=False
414
+ )
415
+
416
+ # Update preview when selections change
417
+ def update_footwear_preview(top_col, foot):
418
+ return f"{top_col} color {foot}"
419
+
420
+ top_color.change(
421
+ fn=update_footwear_preview,
422
+ inputs=[top_color, footwear],
423
+ outputs=footwear_preview
424
+ )
425
+
426
+ footwear.change(
427
+ fn=update_footwear_preview,
428
+ inputs=[top_color, footwear],
429
+ outputs=footwear_preview
430
+ )
431
+
432
+ with gr.Column(scale=1):
433
+ gr.Markdown("### 🧘 Step 5: Pose & Gesture")
434
+
435
+ # Pose Type Selection
436
+ pose_type = gr.Radio(
437
+ choices=["Standing", "Sitting"],
438
+ label="Pose Type",
439
+ value="Standing"
440
+ )
441
+
442
+ # Dynamic dropdown for pose location
443
+ pose_location = gr.Dropdown(
444
+ choices=creator.pose_standing_options,
445
+ label="Pose Location",
446
+ value=creator.pose_standing_options[0]
447
+ )
448
+
449
+ # Function to update pose location
450
+ def update_pose_location(pose):
451
+ if pose == "Standing":
452
+ return gr.Dropdown(
453
+ choices=creator.pose_standing_options,
454
+ value=creator.pose_standing_options[0]
455
+ )
456
+ else:
457
+ return gr.Dropdown(
458
+ choices=creator.pose_sitting_options,
459
+ value=creator.pose_sitting_options[0]
460
+ )
461
+
462
+ pose_type.change(
463
+ fn=update_pose_location,
464
+ inputs=pose_type,
465
+ outputs=pose_location
466
+ )
467
+
468
+ gr.Markdown("---")
469
+ gr.Markdown("### 💋 Step 6: Gesture")
470
+
471
+ gesture = gr.Dropdown(
472
+ choices=creator.gesture_options,
473
+ label="Select Gesture",
474
+ value=creator.gesture_options[0]
475
+ )
476
+
477
+ gr.Markdown("---")
478
+ gr.Markdown("### 🌍 Step 7: Background")
479
+
480
+ background = gr.Dropdown(
481
+ choices=creator.background_options,
482
+ label="Select Background",
483
+ value=creator.background_options[0]
484
+ )
485
+
486
+ gr.Markdown("---")
487
+ gr.Markdown("### 🔍 Step 8: Background Visibility Control")
488
+ gr.Markdown("*Ensure the background is clearly visible*")
489
+
490
+ # Background Visibility Controls
491
+ background_visibility = gr.Dropdown(
492
+ choices=creator.background_visibility_options,
493
+ label="Background Visibility",
494
+ value=creator.background_visibility_options[0]
495
+ )
496
+
497
+ composition = gr.Dropdown(
498
+ choices=creator.composition_options,
499
+ label="Composition Style",
500
+ value=creator.composition_options[0]
501
+ )
502
+
503
+ # Action buttons
504
+ with gr.Row():
505
+ generate_btn = gr.Button("✨ Generate Prompt", variant="primary", size="lg")
506
+ reset_btn = gr.Button("🔄 Reset All", variant="secondary", size="lg")
507
+
508
+ # Tab 2: Prompt Preview
509
+ with gr.TabItem("📝 Prompt Preview", id=1):
510
+ with gr.Column():
511
+ gr.Markdown("### Your Generated Prompt")
512
+ gr.Markdown("*✨ Footwear uses format: **`[Top Color] color [Footwear]`** (e.g., Violet color Heels)*")
513
+
514
+ generated_prompt = gr.Textbox(
515
+ label="",
516
+ lines=12,
517
+ placeholder="Your AI image prompt will appear here...",
518
+ interactive=False
519
+ )
520
+
521
+ # Saree Feature Indicator
522
+ saree_indicator = gr.Textbox(
523
+ label="✨ Special Feature",
524
+ value="No saree feature active",
525
+ interactive=False
526
+ )
527
+
528
+ # Copy button
529
+ gr.HTML("""
530
+ <div style="margin-top: 10px;">
531
+ <button id="copy-prompt-btn" style="background: #28a745; color: white; border: none; padding: 12px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%; font-size: 1.1rem;">
532
+ 📋 Copy Prompt to Clipboard
533
+ </button>
534
+ </div>
535
+ """)
536
+
537
+ # Selection Summary
538
+ gr.Markdown("### 📊 Current Selection Summary")
539
+
540
+ with gr.Row():
541
+ with gr.Column():
542
+ gr.Markdown("**👕 Top Wear:**")
543
+ top_summary = gr.Textbox(
544
+ label="",
545
+ value="Plain Violet Classic V-Neck Full Sleeve Polo T-Shirt",
546
+ interactive=False,
547
+ lines=2
548
+ )
549
+
550
+ with gr.Column():
551
+ gr.Markdown("**👖 Bottom Wear:**")
552
+ bottom_summary = gr.Textbox(
553
+ label="",
554
+ value="Violet Plain Pant",
555
+ interactive=False,
556
+ lines=2
557
+ )
558
+
559
+ with gr.Row():
560
+ with gr.Column():
561
+ gr.Markdown("**👟 Footwear:**")
562
+ footwear_summary = gr.Textbox(
563
+ label="",
564
+ value="Violet color Heels",
565
+ interactive=False
566
+ )
567
+
568
+ with gr.Column():
569
+ gr.Markdown("**🧘 Pose & Gesture:**")
570
+ pose_gesture_summary = gr.Textbox(
571
+ label="",
572
+ value="Standing above on Concrete floor, Rests her chin delicately on her hand",
573
+ interactive=False,
574
+ lines=2
575
+ )
576
+
577
+ gr.Markdown("**🌍 Background Settings:**")
578
+ bg_summary = gr.Textbox(
579
+ label="Background",
580
+ value="TajMahal",
581
+ interactive=False
582
+ )
583
+
584
+ bg_visibility_summary = gr.Textbox(
585
+ label="Visibility Control",
586
+ value="with background clearly visible behind her",
587
+ interactive=False
588
+ )
589
+
590
+ # Tab 3: Help & Examples
591
+ with gr.TabItem("ℹ️ Help & Examples", id=2):
592
+ gr.Markdown("""
593
+ ### 💡 Tips for Best Results
594
+
595
+ - **Color-Coordinated Footwear** - Footwear automatically uses: **`[Top Color] color [Footwear]`**
596
+ * Examples: `Violet color Heels`, `Red color Sneakers`, `Royal Blue color Sandals`
597
+ - **Saree Feature** - Select **Saree** as bottom wear to access complete saree customization
598
+ - **Saree Options** - When Saree is selected, you can customize:
599
+ * Saree Style (Traditional Silk, Kanchipuram, Banarasi, etc.)
600
+ * Saree Fabric (Pure Silk, Cotton, Chiffon, etc.)
601
+ * Pallu Style (7 different draping styles)
602
+ - **Gesture Options** - Choose from 5 natural poses
603
+ - **Background Visibility** - Use controls to ensure background is not obscured
604
+
605
+ ### 🎨 Example Prompt with Color-Coordinated Footwear
606
+ ```
607
+ In Cinematic 16:9 wide frame from ground level, HD quality, cinematic scene, Indian actress Nayanthara with White skinned and tied back ponytail black hairs, and hourglass curve body shape, eyes focus on camera with gentle smile, wearing Plain Violet Classic V-Neck Full Sleeve Designer Blouse, Violet Floral Print Traditional Silk Saree, with her saree's pallu elegantly dropped over her left shoulder, Violet color Heels, Standing above on Marble floor, Rests her chin delicately on her hand, in front of Rajasthan Palace, with background clearly visible behind her, subject positioned to show full background
608
+ ```
609
+ """)
610
+
611
+ # Function to update saree fields visibility based on bottom type
612
+ def update_saree_fields(bottom_type_val):
613
+ if bottom_type_val == "Saree":
614
+ return gr.update(visible=True)
615
+ else:
616
+ return gr.update(visible=False)
617
+
618
+ bottom_type.change(
619
+ fn=update_saree_fields,
620
+ inputs=bottom_type,
621
+ outputs=saree_fields
622
+ )
623
+
624
+ # Function to generate prompt
625
+ def generate_prompt_handler(img, top_pat, top_col, neck, top_style_val, top_type_val,
626
+ bottom_col, bottom_pat, bottom_type_val, foot,
627
+ pose_type_val, pose_loc, gest, bg,
628
+ bg_visibility, comp,
629
+ saree_style_val, saree_fabric_val, pallu_style_val):
630
+
631
+ # Only pass saree parameters if bottom type is Saree
632
+ if bottom_type_val == "Saree":
633
+ prompt = creator.generate_prompt(
634
+ top_pat, top_col, neck, top_style_val, top_type_val,
635
+ bottom_col, bottom_pat, bottom_type_val, foot,
636
+ pose_type_val, pose_loc, gest, bg,
637
+ bg_visibility, comp,
638
+ saree_style_val, saree_fabric_val, pallu_style_val
639
+ )
640
+ else:
641
+ prompt = creator.generate_prompt(
642
+ top_pat, top_col, neck, top_style_val, top_type_val,
643
+ bottom_col, bottom_pat, bottom_type_val, foot,
644
+ pose_type_val, pose_loc, gest, bg,
645
+ bg_visibility, comp
646
+ )
647
+
648
+ # Check if saree feature is active
649
+ is_saree = creator.is_saree_bottom(bottom_type_val)
650
+ saree_status = "✨ Saree fully customized" if is_saree else "No saree feature (select Saree to activate)"
651
+
652
+ # Create summary texts
653
+ top_summary_txt = f"{top_pat} {top_col} {neck} {top_style_val} {top_type_val}"
654
+
655
+ if is_saree:
656
+ bottom_summary_txt = f"{bottom_col} {bottom_pat} {saree_style_val} with {saree_fabric_val} ✨"
657
+ else:
658
+ bottom_summary_txt = f"{bottom_col} {bottom_pat} {bottom_type_val}"
659
+
660
+ # FOOTWEAR FORMATTING: top_color + "color" + footwear
661
+ footwear_summary_txt = f"{top_col} color {foot}"
662
+ pose_gesture_txt = f"{pose_type_val} {pose_loc}, {gest}"
663
+ bg_summary_txt = bg
664
+ bg_visibility_txt = bg_visibility
665
+
666
+ return (
667
+ prompt,
668
+ saree_status,
669
+ top_summary_txt,
670
+ bottom_summary_txt,
671
+ footwear_summary_txt,
672
+ pose_gesture_txt,
673
+ bg_summary_txt,
674
+ bg_visibility_txt
675
+ )
676
+
677
+ # Function to reset all fields
678
+ def reset_all():
679
+ defaults = creator.reset_form()
680
+ return (
681
+ None, # image
682
+ defaults[0], defaults[1], defaults[2], defaults[3], defaults[4],
683
+ defaults[5], defaults[6], defaults[7], defaults[8],
684
+ defaults[9], defaults[10], defaults[11], defaults[12],
685
+ defaults[13], defaults[14], # background visibility and composition
686
+ defaults[15], defaults[16], defaults[17], # saree fields
687
+ "", # clear prompt
688
+ "No saree feature (select Saree to activate)", # saree indicator
689
+ f"{defaults[0]} {defaults[1]} {defaults[2]} {defaults[3]} {defaults[4]}",
690
+ f"{defaults[5]} {defaults[6]} {defaults[7]}",
691
+ f"{defaults[1]} color {defaults[8]}", # footwear format: top_color + "color" + footwear
692
+ f"{defaults[9]} {defaults[10]}, {defaults[11]}",
693
+ defaults[12],
694
+ defaults[13]
695
+ )
696
+
697
+ # Connect generate button
698
+ generate_btn.click(
699
+ fn=generate_prompt_handler,
700
+ inputs=[
701
+ input_image,
702
+ top_pattern, top_color, neck_design, top_style, top_type,
703
+ bottom_color, bottom_pattern, bottom_type,
704
+ footwear,
705
+ pose_type, pose_location,
706
+ gesture,
707
+ background,
708
+ background_visibility,
709
+ composition,
710
+ saree_style, saree_fabric, pallu_style
711
+ ],
712
+ outputs=[
713
+ generated_prompt,
714
+ saree_indicator,
715
+ top_summary, bottom_summary, footwear_summary,
716
+ pose_gesture_summary, bg_summary, bg_visibility_summary
717
+ ]
718
+ )
719
+
720
+ # Connect reset button
721
+ reset_btn.click(
722
+ fn=reset_all,
723
+ inputs=[],
724
+ outputs=[
725
+ input_image,
726
+ top_pattern, top_color, neck_design, top_style, top_type,
727
+ bottom_color, bottom_pattern, bottom_type,
728
+ footwear,
729
+ pose_type, pose_location,
730
+ gesture,
731
+ background,
732
+ background_visibility,
733
+ composition,
734
+ saree_style, saree_fabric, pallu_style,
735
+ generated_prompt,
736
+ saree_indicator,
737
+ top_summary, bottom_summary, footwear_summary,
738
+ pose_gesture_summary, bg_summary, bg_visibility_summary
739
+ ]
740
+ )
741
+
742
+ # Copy button JavaScript
743
+ gr.HTML("""
744
+ <script>
745
+ document.addEventListener('DOMContentLoaded', function() {
746
+ document.getElementById('copy-prompt-btn').addEventListener('click', function() {
747
+ var promptText = document.querySelector('textarea[placeholder*="Your AI image prompt"]').value;
748
+ if (promptText && promptText.trim() !== '') {
749
+ navigator.clipboard.writeText(promptText).then(function() {
750
+ alert('✅ Prompt copied to clipboard!');
751
+ }).catch(function(err) {
752
+ alert('❌ Failed to copy: ' + err);
753
+ });
754
+ } else {
755
+ alert('❌ No prompt to copy. Generate a prompt first.');
756
+ }
757
+ });
758
+ });
759
+ </script>
760
+ """)
761
+
762
+ # Custom CSS
763
+ gr.HTML("""
764
+ <style>
765
+ .gradio-container {
766
+ max-width: 1600px !important;
767
+ margin: auto !important;
768
+ }
769
+ button.primary {
770
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
771
+ }
772
+ .gr-group {
773
+ border: 1px solid #e0e0e0;
774
+ border-radius: 8px;
775
+ padding: 15px;
776
+ margin-bottom: 15px;
777
+ }
778
+ </style>
779
+ """)
780
+
781
+ return demo
782
+
783
+ # Create the app
784
+ demo = create_enhanced_photo_album_app()
785
+
786
+ # Launch with proper settings for Hugging Face
787
+ if __name__ == "__main__":
788
+ demo.launch()
packages.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ libgl1-mesa-glx
2
+ libglib2.0-0