GChilukala commited on
Commit
2b8b022
ยท
verified ยท
1 Parent(s): a34f3fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +291 -48
app.py CHANGED
@@ -1209,68 +1209,148 @@ async def translate_caption_interface(base_caption, selected_languages):
1209
  return result
1210
 
1211
 
1212
- # Replace the CSS section in your create_gradio_app() function with this fixed version:
1213
-
1214
- # Replace the problematic dropdowns with radio buttons - this completely avoids the positioning issue
1215
-
1216
  def create_gradio_app():
1217
- """Create the Gradio app with radio buttons instead of dropdowns"""
1218
 
1219
  # Status indicators
1220
  hf_status = "โœ… Connected" if generator and generator.hf_client_working else "โš ๏ธ Fallback Mode"
1221
  sambanova_status = "โœ… Connected" if generator and generator.sambanova_client_working else "โš ๏ธ Fallback Mode"
1222
 
1223
- # NO CUSTOM CSS AT ALL
1224
- with gr.Blocks(title="๐Ÿ“ฑ Instagram Generator") as app:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1225
 
1226
- # Simple header
1227
  gr.HTML(f"""
1228
- <h1>๐Ÿ“ฑ INSTAGRAM CAPTION GENERATOR</h1>
1229
- <p>๐Ÿš€ AI-Powered Content Creation โ€ข SambaNova + Hugging Face</p>
1230
- <p>๐Ÿค– SambaNova: {sambanova_status} | ๐Ÿค— Hugging Face: {hf_status}</p>
 
 
 
 
 
 
 
 
 
1231
  """)
1232
 
1233
  # Main Interface
1234
  with gr.Tab("๐ŸŽฏ Caption Generator"):
1235
  with gr.Row():
1236
  # Left Column - Controls
1237
- with gr.Column(scale=2):
1238
  gr.Markdown("### ๐Ÿ–ผ๏ธ Upload Images")
 
1239
 
1240
  images = gr.File(
1241
  label="๐Ÿ“ธ Upload Images (Max 3)",
1242
  file_count="multiple",
1243
- file_types=["image"]
 
1244
  )
1245
 
1246
  gr.Markdown("### โš™๏ธ Configuration")
1247
 
1248
- # REPLACE DROPDOWNS WITH RADIO BUTTONS
1249
- caption_style = gr.Radio(
1250
- choices=[
1251
- "๐ŸŽฏ Viral Engagement",
1252
- "๐Ÿ’ผ Professional Brand",
1253
- "๐Ÿ˜„ Casual Fun",
1254
- "๐Ÿ˜‚ Humor & Memes",
1255
- "๐Ÿ’ช Motivational",
1256
- "๐Ÿ“– Storytelling"
1257
- ],
1258
- value="๐ŸŽฏ Viral Engagement",
1259
- label="๐ŸŽจ Caption Style"
1260
- )
1261
-
1262
- target_audience = gr.Radio(
1263
- choices=[
1264
- "๐ŸŒŸ General Audience",
1265
- "๐Ÿ’ผ Business Professionals",
1266
- "โœˆ๏ธ Travel Enthusiasts",
1267
- "๐Ÿ• Food Lovers",
1268
- "๐Ÿ’ช Fitness Community",
1269
- "๐Ÿ‘— Fashion Forward"
1270
- ],
1271
- value="๐ŸŒŸ General Audience",
1272
- label="๐Ÿ‘ฅ Target Audience"
1273
- )
 
 
 
 
1274
 
1275
  custom_prompt = gr.Textbox(
1276
  label="๐Ÿ’ฌ Additional Instructions",
@@ -1280,37 +1360,42 @@ def create_gradio_app():
1280
 
1281
  generate_btn = gr.Button(
1282
  "๐Ÿš€ Generate Caption",
1283
- variant="primary"
 
1284
  )
1285
 
1286
  # Right Column - Results
1287
- with gr.Column(scale=3):
1288
  gr.Markdown("### ๐Ÿ“Š Generated Content")
1289
 
1290
  output = gr.Textbox(
1291
  label="๐ŸŽฏ Generated Caption",
1292
  lines=15,
 
1293
  show_copy_button=True,
1294
  placeholder="Upload images and generate your Instagram content..."
1295
  )
1296
 
1297
- alternatives_btn = gr.Button(
1298
- "โœจ Generate 3 Alternative Captions",
1299
- variant="secondary"
1300
- )
 
 
1301
 
1302
  alternatives_output = gr.Textbox(
1303
  label="โœจ Alternative Captions",
1304
  lines=15,
1305
  show_copy_button=True,
1306
- placeholder="Generate 3 different caption alternatives..."
1307
  )
1308
 
1309
  # Multi-Language Tab
1310
  with gr.Tab("๐ŸŒ Multi-Language"):
1311
  with gr.Row():
1312
- with gr.Column():
1313
  gr.Markdown("### ๐Ÿ—ฃ๏ธ Global Content Creation")
 
1314
 
1315
  base_caption_input = gr.Textbox(
1316
  label="๐Ÿ“ Base Caption",
@@ -1334,7 +1419,7 @@ def create_gradio_app():
1334
  variant="primary"
1335
  )
1336
 
1337
- with gr.Column():
1338
  multilingual_output = gr.Textbox(
1339
  label="๐Ÿ—บ๏ธ Multi-Language Captions",
1340
  lines=20,
@@ -1342,6 +1427,161 @@ def create_gradio_app():
1342
  placeholder="Culturally adapted captions for global audiences..."
1343
  )
1344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1345
  # Event Handlers
1346
  generate_btn.click(
1347
  fn=generate_advanced_caption_interface,
@@ -1349,12 +1589,14 @@ def create_gradio_app():
1349
  outputs=[output, base_caption_input]
1350
  )
1351
 
 
1352
  alternatives_btn.click(
1353
  fn=generate_multiple_captions_interface,
1354
  inputs=[images, caption_style, target_audience, custom_prompt],
1355
  outputs=alternatives_output
1356
  )
1357
 
 
1358
  translate_btn.click(
1359
  fn=translate_caption_interface,
1360
  inputs=[base_caption_input, language_selector],
@@ -1363,6 +1605,7 @@ def create_gradio_app():
1363
 
1364
  return app
1365
 
 
1366
  def main():
1367
  """Main function to launch the Instagram Caption Generator"""
1368
  print("๐Ÿš€ Starting Instagram Caption Generator...")
 
1209
  return result
1210
 
1211
 
 
 
 
 
1212
  def create_gradio_app():
1213
+ """Create the Gradio app with good UI styling"""
1214
 
1215
  # Status indicators
1216
  hf_status = "โœ… Connected" if generator and generator.hf_client_working else "โš ๏ธ Fallback Mode"
1217
  sambanova_status = "โœ… Connected" if generator and generator.sambanova_client_working else "โš ๏ธ Fallback Mode"
1218
 
1219
+ # Enhanced CSS for better UI
1220
+ css = """
1221
+ @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
1222
+
1223
+ .gradio-container {
1224
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
1225
+ font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
1226
+ min-height: 100vh;
1227
+ }
1228
+
1229
+ .main-header {
1230
+ text-align: center;
1231
+ color: white;
1232
+ margin-bottom: 30px;
1233
+ padding: 30px;
1234
+ background: rgba(255,255,255,0.1);
1235
+ border-radius: 20px;
1236
+ backdrop-filter: blur(20px);
1237
+ border: 1px solid rgba(255,255,255,0.2);
1238
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
1239
+ }
1240
+
1241
+ .feature-card {
1242
+ background: rgba(255,255,255,0.1);
1243
+ border-radius: 15px;
1244
+ padding: 20px;
1245
+ backdrop-filter: blur(15px);
1246
+ border: 1px solid rgba(255,255,255,0.2);
1247
+ box-shadow: 0 15px 30px rgba(0,0,0,0.1);
1248
+ margin: 10px 0;
1249
+ }
1250
+
1251
+ .gradio-button-primary {
1252
+ background: linear-gradient(45deg, #ff6b6b, #ee5a24, #ff9ff3, #54a0ff) !important;
1253
+ border: none !important;
1254
+ border-radius: 15px !important;
1255
+ padding: 15px 25px !important;
1256
+ font-weight: 600 !important;
1257
+ color: white !important;
1258
+ box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3) !important;
1259
+ transition: all 0.3s ease !important;
1260
+ }
1261
+
1262
+ .gradio-button-primary:hover {
1263
+ transform: translateY(-2px) !important;
1264
+ box-shadow: 0 15px 30px rgba(255, 107, 107, 0.5) !important;
1265
+ }
1266
+
1267
+ .gradio-button-secondary {
1268
+ background: linear-gradient(45deg, #feca57, #ff9ff3, #54a0ff, #5f27cd) !important;
1269
+ border: none !important;
1270
+ border-radius: 12px !important;
1271
+ padding: 12px 20px !important;
1272
+ font-weight: 600 !important;
1273
+ color: white !important;
1274
+ box-shadow: 0 8px 16px rgba(254, 202, 87, 0.3) !important;
1275
+ }
1276
+
1277
+ .status-badge {
1278
+ background: linear-gradient(90deg, #2ecc71, #27ae60);
1279
+ color: white;
1280
+ padding: 10px 20px;
1281
+ border-radius: 10px;
1282
+ text-align: center;
1283
+ font-weight: 600;
1284
+ box-shadow: 0 8px 16px rgba(46, 204, 113, 0.3);
1285
+ margin: 10px 0;
1286
+ }
1287
+ """
1288
+
1289
+ with gr.Blocks(css=css, title="๐Ÿ“ฑ Instagram Generator", theme=gr.themes.Glass()) as app:
1290
 
1291
+ # Main Header
1292
  gr.HTML(f"""
1293
+ <div class="main-header">
1294
+ <h1 style="font-size: 2.5rem; margin-bottom: 15px; font-weight: 800; background: linear-gradient(45deg, #ff6b6b, #feca57, #ff9ff3, #54a0ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">
1295
+ ๐Ÿ“ฑ INSTAGRAM CAPTION GENERATOR
1296
+ </h1>
1297
+ <h2 style="font-size: 1.2rem; margin-bottom: 20px; opacity: 0.9;">
1298
+ ๐Ÿš€ AI-Powered Content Creation โ€ข SambaNova + Hugging Face
1299
+ </h2>
1300
+ <div style="display: flex; justify-content: center; gap: 20px; margin-top: 15px;">
1301
+ <span style="background: rgba(255,255,255,0.2); padding: 8px 16px; border-radius: 15px;">๐Ÿค– SambaNova: {sambanova_status}</span>
1302
+ <span style="background: rgba(255,255,255,0.2); padding: 8px 16px; border-radius: 15px;">๐Ÿค— Hugging Face: {hf_status}</span>
1303
+ </div>
1304
+ </div>
1305
  """)
1306
 
1307
  # Main Interface
1308
  with gr.Tab("๐ŸŽฏ Caption Generator"):
1309
  with gr.Row():
1310
  # Left Column - Controls
1311
+ with gr.Column(scale=2, elem_classes=["feature-card"]):
1312
  gr.Markdown("### ๐Ÿ–ผ๏ธ Upload Images")
1313
+ gr.Markdown("*SambaNova AI vision analysis with quality scoring*")
1314
 
1315
  images = gr.File(
1316
  label="๐Ÿ“ธ Upload Images (Max 3)",
1317
  file_count="multiple",
1318
+ file_types=["image"],
1319
+ height=200
1320
  )
1321
 
1322
  gr.Markdown("### โš™๏ธ Configuration")
1323
 
1324
+ with gr.Row():
1325
+ caption_style = gr.Dropdown(
1326
+ choices=[
1327
+ "๐ŸŽฏ Viral Engagement",
1328
+ "๐Ÿ’ผ Professional Brand",
1329
+ "๐Ÿ˜„ Casual Fun",
1330
+ "๐Ÿ˜‚ Humor & Memes",
1331
+ "๐Ÿ’ช Motivational",
1332
+ "๐Ÿ“– Storytelling",
1333
+ "๐ŸŒŸ Luxury Lifestyle",
1334
+ "๐Ÿ”ฅ Trending Culture"
1335
+ ],
1336
+ value="๐ŸŽฏ Viral Engagement",
1337
+ label="๐ŸŽจ Caption Style"
1338
+ )
1339
+
1340
+ target_audience = gr.Dropdown(
1341
+ choices=[
1342
+ "๐ŸŒŸ General Audience",
1343
+ "๐Ÿ’ผ Business Professionals",
1344
+ "โœˆ๏ธ Travel Enthusiasts",
1345
+ "๐Ÿ• Food Lovers",
1346
+ "๐Ÿ’ช Fitness Community",
1347
+ "๐Ÿ‘— Fashion Forward",
1348
+ "๐Ÿ’ป Tech Innovators",
1349
+ "๐ŸŽจ Creative Artists"
1350
+ ],
1351
+ value="๐ŸŒŸ General Audience",
1352
+ label="๐Ÿ‘ฅ Target Audience"
1353
+ )
1354
 
1355
  custom_prompt = gr.Textbox(
1356
  label="๐Ÿ’ฌ Additional Instructions",
 
1360
 
1361
  generate_btn = gr.Button(
1362
  "๐Ÿš€ Generate Caption",
1363
+ variant="primary",
1364
+ size="lg"
1365
  )
1366
 
1367
  # Right Column - Results
1368
+ with gr.Column(scale=3, elem_classes=["feature-card"]):
1369
  gr.Markdown("### ๐Ÿ“Š Generated Content")
1370
 
1371
  output = gr.Textbox(
1372
  label="๐ŸŽฏ Generated Caption",
1373
  lines=15,
1374
+ max_lines=20,
1375
  show_copy_button=True,
1376
  placeholder="Upload images and generate your Instagram content..."
1377
  )
1378
 
1379
+ with gr.Row():
1380
+ alternatives_btn = gr.Button(
1381
+ "โœจ Generate 3 Alternative Captions",
1382
+ variant="secondary",
1383
+ scale=1
1384
+ )
1385
 
1386
  alternatives_output = gr.Textbox(
1387
  label="โœจ Alternative Captions",
1388
  lines=15,
1389
  show_copy_button=True,
1390
+ placeholder="Generate 3 different caption alternatives using Meta-Llama-3.2-3B-Instruct..."
1391
  )
1392
 
1393
  # Multi-Language Tab
1394
  with gr.Tab("๐ŸŒ Multi-Language"):
1395
  with gr.Row():
1396
+ with gr.Column(elem_classes=["feature-card"]):
1397
  gr.Markdown("### ๐Ÿ—ฃ๏ธ Global Content Creation")
1398
+ gr.Markdown("*Powered by Hugging Face Translation Models*")
1399
 
1400
  base_caption_input = gr.Textbox(
1401
  label="๐Ÿ“ Base Caption",
 
1419
  variant="primary"
1420
  )
1421
 
1422
+ with gr.Column(elem_classes=["feature-card"]):
1423
  multilingual_output = gr.Textbox(
1424
  label="๐Ÿ—บ๏ธ Multi-Language Captions",
1425
  lines=20,
 
1427
  placeholder="Culturally adapted captions for global audiences..."
1428
  )
1429
 
1430
+ # SambaNova Features Tab
1431
+ with gr.Tab("๐Ÿค– SambaNova Features"):
1432
+ gr.HTML(f"""
1433
+ <div class="status-badge">
1434
+ ๐Ÿš€ SambaNova Status: {sambanova_status} โ€ข ๐Ÿฆ™ Llama-4-Maverick + Llama-3.2-3B
1435
+ </div>
1436
+ """)
1437
+
1438
+ with gr.Row():
1439
+ with gr.Column(elem_classes=["feature-card"]):
1440
+ gr.HTML("""
1441
+ <div style="text-align: center; padding: 20px;">
1442
+ <h3>โšก SambaNova AI Capabilities</h3>
1443
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 20px;">
1444
+ <div style="padding: 15px; background: rgba(46, 204, 113, 0.2); border-radius: 10px; border: 2px solid #2ecc71;">
1445
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #2ecc71;">Llama-4-Maverick</h4>
1446
+ <p style="margin: 5px 0; color: #e8f8f5; font-weight: 500;">Main Caption Generation</p>
1447
+ </div>
1448
+ <div style="padding: 15px; background: rgba(52, 152, 219, 0.2); border-radius: 10px; border: 2px solid #3498db;">
1449
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #3498db;">Llama-3.2-3B</h4>
1450
+ <p style="margin: 5px 0; color: #ebf3fd; font-weight: 500;">Caption Variations</p>
1451
+ </div>
1452
+ <div style="padding: 15px; background: rgba(231, 76, 60, 0.2); border-radius: 10px; border: 2px solid #e74c3c;">
1453
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #e74c3c;">Multi-Modal</h4>
1454
+ <p style="margin: 5px 0; color: #fdedec; font-weight: 500;">Vision + Text Analysis</p>
1455
+ </div>
1456
+ <div style="padding: 15px; background: rgba(155, 89, 182, 0.2); border-radius: 10px; border: 2px solid #9b59b6;">
1457
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #9b59b6;">Advanced</h4>
1458
+ <p style="margin: 5px 0; color: #f4ecf7; font-weight: 500;">Style & Audience Targeting</p>
1459
+ </div>
1460
+ </div>
1461
+ </div>
1462
+ """)
1463
+
1464
+ with gr.Column(elem_classes=["feature-card"]):
1465
+ gr.Code(
1466
+ value="""
1467
+ # SambaNova API Integration:
1468
+
1469
+ from openai import OpenAI
1470
+
1471
+ client = OpenAI(
1472
+ api_key=os.environ["SAMBANOVA_API_KEY"],
1473
+ base_url="https://api.sambanova.ai/v1",
1474
+ )
1475
+
1476
+ # Main caption generation
1477
+ response = client.chat.completions.create(
1478
+ model="Llama-4-Maverick-17B-128E-Instruct",
1479
+ messages=[{
1480
+ "role": "user",
1481
+ "content": [
1482
+ {"type": "text", "text": "Create Instagram caption"},
1483
+ {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
1484
+ ]
1485
+ }],
1486
+ temperature=0.1,
1487
+ top_p=0.1
1488
+ )
1489
+
1490
+ # Caption variations
1491
+ variations = client.chat.completions.create(
1492
+ model="Meta-Llama-3.2-3B-Instruct",
1493
+ messages=[{
1494
+ "role": "user",
1495
+ "content": "Create different version of this caption..."
1496
+ }],
1497
+ temperature=0.9,
1498
+ top_p=0.95
1499
+ )
1500
+ """,
1501
+ language="python",
1502
+ label="๐Ÿ”ง SambaNova Integration Code"
1503
+ )
1504
+
1505
+ # Hugging Face Features Tab
1506
+ with gr.Tab("๐Ÿค— Hugging Face Features"):
1507
+ gr.HTML(f"""
1508
+ <div class="status-badge">
1509
+ ๐Ÿค— Hugging Face Status: {hf_status} โ€ข ๐ŸŒ Multi-Language Translation
1510
+ </div>
1511
+ """)
1512
+
1513
+ with gr.Row():
1514
+ with gr.Column(elem_classes=["feature-card"]):
1515
+ gr.HTML("""
1516
+ <div style="text-align: center; padding: 20px;">
1517
+ <h3>๐ŸŒ Translation Models</h3>
1518
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 20px;">
1519
+ <div style="padding: 15px; background: rgba(46, 204, 113, 0.2); border-radius: 10px; border: 2px solid #2ecc71;">
1520
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #2ecc71;">๐Ÿ‡ฉ๐Ÿ‡ช German</h4>
1521
+ <p style="margin: 5px 0; color: #e8f8f5; font-weight: 500;">google-t5/t5-small</p>
1522
+ </div>
1523
+ <div style="padding: 15px; background: rgba(52, 152, 219, 0.2); border-radius: 10px; border: 2px solid #3498db;">
1524
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #3498db;">๐Ÿ‡จ๐Ÿ‡ณ Chinese</h4>
1525
+ <p style="margin: 5px 0; color: #ebf3fd; font-weight: 500;">chence08/mt5-small-iwslt2017-zh-en</p>
1526
+ </div>
1527
+ <div style="padding: 15px; background: rgba(231, 76, 60, 0.2); border-radius: 10px; border: 2px solid #e74c3c;">
1528
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #e74c3c;">๐Ÿ‡ฎ๐Ÿ‡ณ Hindi</h4>
1529
+ <p style="margin: 5px 0; color: #fdedec; font-weight: 500;">Helsinki-NLP/opus-mt-en-hi</p>
1530
+ </div>
1531
+ <div style="padding: 15px; background: rgba(155, 89, 182, 0.2); border-radius: 10px; border: 2px solid #9b59b6;">
1532
+ <h4 style="color: #ffffff; margin: 0; text-shadow: 0 0 10px #9b59b6;">๐Ÿ‡ธ๐Ÿ‡ฆ Arabic</h4>
1533
+ <p style="margin: 5px 0; color: #f4ecf7; font-weight: 500;">marefa-nlp/marefa-mt-en-ar</p>
1534
+ </div>
1535
+ </div>
1536
+ </div>
1537
+ """)
1538
+
1539
+ with gr.Column(elem_classes=["feature-card"]):
1540
+ gr.Code(
1541
+ value="""
1542
+ # Hugging Face Translation Integration:
1543
+
1544
+ from huggingface_hub import InferenceClient
1545
+
1546
+ client = InferenceClient(
1547
+ provider="hf-inference",
1548
+ api_key=os.environ["HF_TOKEN"],
1549
+ )
1550
+
1551
+ # German translation
1552
+ german_result = client.translation(
1553
+ "This is an amazing moment! โœจ",
1554
+ model="google-t5/t5-small",
1555
+ )
1556
+
1557
+ # Chinese translation
1558
+ chinese_result = client.translation(
1559
+ "Amazing content for Instagram",
1560
+ model="chence08/mt5-small-iwslt2017-zh-en",
1561
+ )
1562
+
1563
+ # Hindi translation
1564
+ hindi_result = client.translation(
1565
+ "Beautiful content creation",
1566
+ model="Helsinki-NLP/opus-mt-en-hi",
1567
+ )
1568
+
1569
+ # Arabic translation
1570
+ arabic_result = client.translation(
1571
+ "Social media content",
1572
+ model="marefa-nlp/marefa-mt-en-ar",
1573
+ )
1574
+
1575
+ # Features:
1576
+ # โœ… 4 language models
1577
+ # โœ… Fallback support
1578
+ # โœ… Instagram-optimized output
1579
+ # โœ… Cultural adaptation
1580
+ """,
1581
+ language="python",
1582
+ label="๐Ÿ”ง Hugging Face Translation Code"
1583
+ )
1584
+
1585
  # Event Handlers
1586
  generate_btn.click(
1587
  fn=generate_advanced_caption_interface,
 
1589
  outputs=[output, base_caption_input]
1590
  )
1591
 
1592
+ # Generate multiple alternatives
1593
  alternatives_btn.click(
1594
  fn=generate_multiple_captions_interface,
1595
  inputs=[images, caption_style, target_audience, custom_prompt],
1596
  outputs=alternatives_output
1597
  )
1598
 
1599
+ # Multi-language translation
1600
  translate_btn.click(
1601
  fn=translate_caption_interface,
1602
  inputs=[base_caption_input, language_selector],
 
1605
 
1606
  return app
1607
 
1608
+
1609
  def main():
1610
  """Main function to launch the Instagram Caption Generator"""
1611
  print("๐Ÿš€ Starting Instagram Caption Generator...")