lulavc commited on
Commit
c676bb8
·
verified ·
1 Parent(s): 5a1522c

v2.3.1: Fix language switching - connect lang_selector.change() to update all 36 UI components

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -1433,7 +1433,7 @@ with gr.Blocks(title="Z Image Turbo", css=css, theme=dark_theme) as demo:
1433
 
1434
  # TAB 2: AI Vision Assistant
1435
  with gr.Tab("AI Assistant"):
1436
- gr.Markdown("**AI-Powered Prompt Generator** - Upload an image, analyze it with GLM-4.6V, then generate optimized prompts.")
1437
 
1438
  with gr.Row():
1439
  with gr.Column(scale=1):
@@ -1449,7 +1449,7 @@ with gr.Blocks(title="Z Image Turbo", css=css, theme=dark_theme) as demo:
1449
  ai_send_btn = gr.Button("Send to Transform Tab", variant="primary")
1450
 
1451
  with gr.Accordion("How to Use", open=False):
1452
- gr.Markdown("""
1453
  1. **Upload** an image and click "Analyze Image"
1454
  2. **Describe** the changes you want
1455
  3. **Generate** an optimized prompt
@@ -1469,7 +1469,7 @@ with gr.Blocks(title="Z Image Turbo", css=css, theme=dark_theme) as demo:
1469
 
1470
  # TAB 3: Transform Image
1471
  with gr.Tab("Transform"):
1472
- gr.Markdown("**Transform your image** - Upload and describe the transformation. Lower strength = subtle, higher = dramatic.")
1473
 
1474
  with gr.Row():
1475
  with gr.Column(scale=2):
@@ -1526,6 +1526,24 @@ with gr.Blocks(title="Z Image Turbo", css=css, theme=dark_theme) as demo:
1526
  outputs=[trans_prompt, trans_input]
1527
  )
1528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1529
  gr.HTML(
1530
  """
1531
  <div style="text-align: center; width: 100%; font-size: 0.9rem; padding: 1rem; margin-top: 1.5rem; background: #141416; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; color: #71717a;">
 
1433
 
1434
  # TAB 2: AI Vision Assistant
1435
  with gr.Tab("AI Assistant"):
1436
+ ai_desc_md = gr.Markdown("**AI-Powered Prompt Generator** - Upload an image, analyze it with GLM-4.6V, then generate optimized prompts.")
1437
 
1438
  with gr.Row():
1439
  with gr.Column(scale=1):
 
1449
  ai_send_btn = gr.Button("Send to Transform Tab", variant="primary")
1450
 
1451
  with gr.Accordion("How to Use", open=False):
1452
+ ai_howto_md = gr.Markdown("""
1453
  1. **Upload** an image and click "Analyze Image"
1454
  2. **Describe** the changes you want
1455
  3. **Generate** an optimized prompt
 
1469
 
1470
  # TAB 3: Transform Image
1471
  with gr.Tab("Transform"):
1472
+ trans_desc_md = gr.Markdown("**Transform your image** - Upload and describe the transformation. Lower strength = subtle, higher = dramatic.")
1473
 
1474
  with gr.Row():
1475
  with gr.Column(scale=2):
 
1526
  outputs=[trans_prompt, trans_input]
1527
  )
1528
 
1529
+ # Language selector - update all UI labels when language changes
1530
+ lang_selector.change(
1531
+ fn=change_language,
1532
+ inputs=[lang_selector],
1533
+ outputs=[
1534
+ # Generate tab (12 components)
1535
+ gen_prompt, gen_polish, gen_style, gen_ratio, gen_steps, gen_seed,
1536
+ gen_randomize, gen_btn, gen_output, gen_polished_prompt, gen_seed_out, gen_share_btn,
1537
+ # AI Assistant tab (10 components)
1538
+ ai_desc_md, ai_image, ai_analyze_btn, ai_description, ai_request, ai_style,
1539
+ ai_generate_btn, ai_generated_prompt, ai_send_btn, ai_howto_md,
1540
+ # Transform tab (14 components)
1541
+ trans_desc_md, trans_input, trans_prompt, trans_polish, trans_style, trans_strength,
1542
+ trans_steps, trans_seed, trans_randomize, trans_btn, trans_output, trans_polished_prompt,
1543
+ trans_seed_out, trans_share_btn,
1544
+ ]
1545
+ )
1546
+
1547
  gr.HTML(
1548
  """
1549
  <div style="text-align: center; width: 100%; font-size: 0.9rem; padding: 1rem; margin-top: 1.5rem; background: #141416; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; color: #71717a;">