akhaliq HF Staff commited on
Commit
4361e4f
·
1 Parent(s): 091b994

remove beta chat

Browse files
Files changed (1) hide show
  1. app.py +15 -410
app.py CHANGED
@@ -8216,14 +8216,6 @@ with gr.Blocks(
8216
  margin: 8px 0;
8217
  text-align: center;
8218
  }
8219
- /* Darker chat bubbles for better contrast in dark theme */
8220
- #beta_chat .message.user, #beta_chat .message.assistant {
8221
- background: rgba(60, 60, 60, 0.85);
8222
- color: #f5f5f5;
8223
- }
8224
- #beta_chat .message.user {
8225
- background: rgba(70, 70, 70, 0.95);
8226
- }
8227
  /* Authentication status styling */
8228
  .auth-status {
8229
  padding: 8px 12px;
@@ -8262,34 +8254,7 @@ with gr.Blocks(
8262
  elem_classes=["auth-status"]
8263
  )
8264
 
8265
- beta_toggle = gr.Checkbox(
8266
- value=False,
8267
- label="Beta: Chat UI",
8268
- info="Switch to the new chat-based sidebar interface"
8269
- )
8270
 
8271
- # Simple chat-based controller for sidebar
8272
- sidebar_chatbot = gr.Chatbot(
8273
- type="messages",
8274
- show_label=False,
8275
- height=320,
8276
- layout="bubble",
8277
- group_consecutive_messages=True,
8278
- visible=False,
8279
- elem_id="beta_chat"
8280
- )
8281
- sidebar_msg = gr.MultimodalTextbox(
8282
- placeholder=(
8283
- "Describe what to build. Examples: 'use streamlit', 'text to video: <prompt>'. "
8284
- "See Advanced Commands below for the full list."
8285
- ),
8286
- submit_btn=True,
8287
- stop_btn=False,
8288
- show_label=False,
8289
- sources=["upload", "microphone"],
8290
- visible=False
8291
- )
8292
- chat_clear_btn = gr.ClearButton([sidebar_msg, sidebar_chatbot], visible=False)
8293
 
8294
  # Collapsed Advanced Commands reference
8295
  with gr.Accordion(label="Advanced Commands", open=False, visible=False) as advanced_commands:
@@ -8522,52 +8487,51 @@ with gr.Blocks(
8522
 
8523
  # LLM-guided media placement is now always on (no toggle in UI)
8524
 
8525
- def on_image_to_image_toggle(toggled, beta_enabled):
8526
- # Only show in classic mode (beta disabled)
8527
- vis = bool(toggled) and not bool(beta_enabled)
8528
  return gr.update(visible=vis), gr.update(visible=vis)
8529
 
8530
- def on_text_to_image_toggle(toggled, beta_enabled):
8531
- vis = bool(toggled) and not bool(beta_enabled)
8532
  return gr.update(visible=vis)
8533
 
8534
  image_to_image_toggle.change(
8535
  on_image_to_image_toggle,
8536
- inputs=[image_to_image_toggle, beta_toggle],
8537
  outputs=[generation_image_input, image_to_image_prompt]
8538
  )
8539
- def on_image_to_video_toggle(toggled, beta_enabled):
8540
- vis = bool(toggled) and not bool(beta_enabled)
8541
  return gr.update(visible=vis), gr.update(visible=vis)
8542
 
8543
  image_to_video_toggle.change(
8544
  on_image_to_video_toggle,
8545
- inputs=[image_to_video_toggle, beta_toggle],
8546
  outputs=[generation_image_input, image_to_video_prompt]
8547
  )
8548
  image_generation_toggle.change(
8549
  on_text_to_image_toggle,
8550
- inputs=[image_generation_toggle, beta_toggle],
8551
  outputs=[text_to_image_prompt]
8552
  )
8553
  text_to_video_toggle.change(
8554
  on_text_to_image_toggle,
8555
- inputs=[text_to_video_toggle, beta_toggle],
8556
  outputs=[text_to_video_prompt]
8557
  )
8558
  video_to_video_toggle.change(
8559
  on_image_to_video_toggle,
8560
- inputs=[video_to_video_toggle, beta_toggle],
8561
  outputs=[video_input, video_to_video_prompt]
8562
  )
8563
  text_to_music_toggle.change(
8564
  on_text_to_image_toggle,
8565
- inputs=[text_to_music_toggle, beta_toggle],
8566
  outputs=[text_to_music_prompt]
8567
  )
8568
 
8569
- def on_image_video_to_animation_toggle(toggled, beta_enabled):
8570
- vis = bool(toggled) and not bool(beta_enabled)
8571
  return (
8572
  gr.update(visible=vis), # generation_image_input
8573
  gr.update(visible=vis), # animation_mode_dropdown
@@ -8577,7 +8541,7 @@ with gr.Blocks(
8577
 
8578
  image_video_to_animation_toggle.change(
8579
  on_image_video_to_animation_toggle,
8580
- inputs=[image_video_to_animation_toggle, beta_toggle],
8581
  outputs=[generation_image_input, animation_mode_dropdown, animation_quality_dropdown, animation_video_input]
8582
  )
8583
  model_dropdown = gr.Dropdown(
@@ -9202,367 +9166,8 @@ with gr.Blocks(
9202
  import re
9203
  match = re.search(r"https?://[^\s]+", text or "")
9204
  return match.group(0) if match else None
9205
- def apply_chat_command(message, chat_messages):
9206
- # Support plain text or dict from MultimodalTextbox
9207
- text = message if isinstance(message, str) else (message.get("text", "") if isinstance(message, dict) else "")
9208
- files = []
9209
- if isinstance(message, dict):
9210
- files = message.get("files", []) or []
9211
-
9212
- # Defaults to skip updates where unchanged
9213
- upd_input = gr.skip()
9214
- upd_language = gr.skip()
9215
- upd_url = gr.skip()
9216
- upd_file = gr.skip()
9217
- upd_image_for_gen = gr.skip()
9218
- upd_search = gr.skip()
9219
- upd_img_gen = gr.skip()
9220
- upd_t2i_prompt = gr.skip()
9221
- upd_i2i_toggle = gr.skip()
9222
- upd_i2i_prompt = gr.skip()
9223
- upd_i2v_toggle = gr.skip()
9224
- upd_i2v_prompt = gr.skip()
9225
- upd_t2v_toggle = gr.skip()
9226
- upd_t2v_prompt = gr.skip()
9227
- upd_v2v_toggle = gr.skip()
9228
- upd_v2v_prompt = gr.skip()
9229
- upd_video_input = gr.skip()
9230
- upd_model_dropdown = gr.skip()
9231
- upd_current_model = gr.skip()
9232
- upd_t2m_toggle = gr.skip()
9233
- upd_t2m_prompt = gr.skip()
9234
- upd_iv2a_toggle = gr.skip()
9235
- upd_anim_mode = gr.skip()
9236
- upd_anim_quality = gr.skip()
9237
- upd_anim_video = gr.skip()
9238
-
9239
- # Split by comma to separate main prompt and directives
9240
- segments = [seg.strip() for seg in (text or "").split(",") if seg.strip()]
9241
- main_prompt = segments[0] if segments else text
9242
-
9243
- # Helper to get text after ':' in original casing
9244
- def after_colon(original_segment: str) -> str:
9245
- parts = original_segment.split(":", 1)
9246
- return parts[1].strip() if len(parts) == 2 else ""
9247
-
9248
- # Process directives from all segments (including first if user puts directives there),
9249
- # but always set the main build prompt from the first segment only
9250
- for seg in segments:
9251
- seg_norm = seg.lower()
9252
- # Language
9253
- if "use streamlit" in seg_norm:
9254
- upd_language = gr.update(value="streamlit")
9255
- elif "use gradio" in seg_norm:
9256
- upd_language = gr.update(value="gradio")
9257
- elif "use html" in seg_norm or "as html" in seg_norm:
9258
- upd_language = gr.update(value="html")
9259
-
9260
- # Web search
9261
- if (
9262
- "enable web search" in seg_norm
9263
- or "web search on" in seg_norm
9264
- or "with web search" in seg_norm
9265
- or "search the web" in seg_norm
9266
- ):
9267
- upd_search = gr.update(value=True)
9268
- if (
9269
- "disable web search" in seg_norm
9270
- or "no web search" in seg_norm
9271
- or "web search off" in seg_norm
9272
- ):
9273
- upd_search = gr.update(value=False)
9274
-
9275
- # Text-to-image
9276
- if ("generate images" in seg_norm) or ("text to image" in seg_norm) or ("text-to-image" in seg_norm):
9277
- upd_img_gen = gr.update(value=True)
9278
- p = after_colon(seg)
9279
- if p:
9280
- upd_t2i_prompt = gr.update(value=p)
9281
-
9282
- # Image-to-image
9283
- if ("image to image" in seg_norm) or ("image-to-image" in seg_norm) or ("transform image" in seg_norm):
9284
- upd_i2i_toggle = gr.update(value=True)
9285
- p = after_colon(seg)
9286
- if p:
9287
- upd_i2i_prompt = gr.update(value=p)
9288
-
9289
- # Image-to-video
9290
- if ("image to video" in seg_norm) or ("image-to-video" in seg_norm):
9291
- upd_i2v_toggle = gr.update(value=True)
9292
- p = after_colon(seg)
9293
- if p:
9294
- upd_i2v_prompt = gr.update(value=p)
9295
-
9296
- # Text-to-video
9297
- if ("text to video" in seg_norm) or ("text-to-video" in seg_norm) or ("generate video" in seg_norm):
9298
- upd_t2v_toggle = gr.update(value=True)
9299
- p = after_colon(seg)
9300
- if p:
9301
- upd_t2v_prompt = gr.update(value=p)
9302
-
9303
- # Video-to-video
9304
- if ("video to video" in seg_norm) or ("video-to-video" in seg_norm) or ("transform video" in seg_norm):
9305
- upd_v2v_toggle = gr.update(value=True)
9306
- p = after_colon(seg)
9307
- if p:
9308
- upd_v2v_prompt = gr.update(value=p)
9309
-
9310
- # Text-to-music
9311
- if ("text to music" in seg_norm) or ("text-to-music" in seg_norm) or ("generate music" in seg_norm) or ("compose music" in seg_norm):
9312
- upd_t2m_toggle = gr.update(value=True)
9313
- p = after_colon(seg)
9314
- if p:
9315
- upd_t2m_prompt = gr.update(value=p)
9316
-
9317
- # Image+Video-to-Animation
9318
- if ("animate" in seg_norm) or ("character animation" in seg_norm) or ("wan animate" in seg_norm):
9319
- upd_iv2a_toggle = gr.update(value=True)
9320
- # Check for mode specification
9321
- if "move mode" in seg_norm:
9322
- upd_anim_mode = gr.update(value="wan2.2-animate-move")
9323
- elif "mix mode" in seg_norm:
9324
- upd_anim_mode = gr.update(value="wan2.2-animate-mix")
9325
- # Check for quality specification
9326
- if "standard quality" in seg_norm or "std quality" in seg_norm:
9327
- upd_anim_quality = gr.update(value="wan-std")
9328
- elif "professional quality" in seg_norm or "pro quality" in seg_norm:
9329
- upd_anim_quality = gr.update(value="wan-pro")
9330
-
9331
- # URL (website redesign)
9332
- url = _extract_url(seg)
9333
- if url:
9334
- upd_url = gr.update(value=url)
9335
-
9336
- # Model selection
9337
- if "model " in seg_norm:
9338
- try:
9339
- model_name = seg.split("model", 1)[1].strip()
9340
- except Exception:
9341
- model_name = ""
9342
- if model_name:
9343
- model_obj = _find_model_by_name(model_name)
9344
- if model_obj is not None:
9345
- upd_model_dropdown = gr.update(value=model_obj["name"]) # keep dropdown in sync
9346
- upd_current_model = model_obj # pass directly to State for immediate effect
9347
-
9348
- # Files: attach first non-image/video to file_input; image to generation_image_input; video to video_input
9349
- img_assigned = False
9350
- video_assigned = False
9351
- non_media_assigned = False
9352
- for f in files:
9353
- try:
9354
- path = f["path"] if isinstance(f, dict) and "path" in f else f
9355
- except Exception:
9356
- path = None
9357
- if not path:
9358
- continue
9359
- if not img_assigned and any(str(path).lower().endswith(ext) for ext in [".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp", ".tiff", ".tif"]):
9360
- upd_image_for_gen = gr.update(value=path)
9361
- img_assigned = True
9362
- elif not video_assigned and any(str(path).lower().endswith(ext) for ext in [".mp4", ".avi", ".mov", ".mkv", ".webm", ".m4v"]):
9363
- upd_video_input = gr.update(value=path)
9364
- video_assigned = True
9365
- elif not non_media_assigned:
9366
- upd_file = gr.update(value=path)
9367
- non_media_assigned = True
9368
-
9369
- # Set main build intent from first segment (if present), otherwise full text
9370
- if main_prompt:
9371
- upd_input = gr.update(value=main_prompt)
9372
-
9373
- # Build assistant acknowledgement
9374
- ack = "Configured. Running generation with your latest instructions."
9375
- if not chat_messages:
9376
- chat_messages = []
9377
- chat_messages.append({"role": "user", "content": text})
9378
- chat_messages.append({"role": "assistant", "content": ack})
9379
-
9380
- return (
9381
- "",
9382
- gr.update(value=chat_messages, visible=True),
9383
- upd_input,
9384
- upd_language,
9385
- upd_url,
9386
- upd_file,
9387
- upd_image_for_gen,
9388
- upd_search,
9389
- upd_img_gen,
9390
- upd_t2i_prompt,
9391
- upd_i2i_toggle,
9392
- upd_i2i_prompt,
9393
- upd_i2v_toggle,
9394
- upd_i2v_prompt,
9395
- upd_t2v_toggle,
9396
- upd_t2v_prompt,
9397
- upd_v2v_toggle,
9398
- upd_v2v_prompt,
9399
- upd_video_input,
9400
- upd_model_dropdown,
9401
- upd_current_model,
9402
- upd_t2m_toggle,
9403
- upd_t2m_prompt,
9404
- upd_iv2a_toggle,
9405
- upd_anim_mode,
9406
- upd_anim_quality,
9407
- upd_anim_video,
9408
- )
9409
-
9410
- # Wire chat submit -> apply settings -> run generation
9411
- sidebar_msg.submit(
9412
- apply_chat_command,
9413
- inputs=[sidebar_msg, sidebar_chatbot],
9414
- outputs=[
9415
- sidebar_msg,
9416
- sidebar_chatbot,
9417
- input,
9418
- language_dropdown,
9419
- website_url_input,
9420
- file_input,
9421
- generation_image_input,
9422
- search_toggle,
9423
- image_generation_toggle,
9424
- text_to_image_prompt,
9425
- image_to_image_toggle,
9426
- image_to_image_prompt,
9427
- image_to_video_toggle,
9428
- image_to_video_prompt,
9429
- text_to_video_toggle,
9430
- text_to_video_prompt,
9431
- video_to_video_toggle,
9432
- video_to_video_prompt,
9433
- video_input,
9434
- model_dropdown,
9435
- current_model,
9436
- text_to_music_toggle,
9437
- text_to_music_prompt,
9438
- image_video_to_animation_toggle,
9439
- animation_mode_dropdown,
9440
- animation_quality_dropdown,
9441
- animation_video_input,
9442
- ],
9443
- queue=False,
9444
- ).then(
9445
- begin_generation_ui,
9446
- inputs=None,
9447
- outputs=[sidebar, generating_status],
9448
- show_progress="hidden",
9449
- ).then(
9450
- generation_code,
9451
- inputs=[input, image_input, generation_image_input, file_input, website_url_input, setting, history, current_model, search_toggle, language_dropdown, provider_state, image_generation_toggle, image_to_image_toggle, image_to_image_prompt, text_to_image_prompt, image_to_video_toggle, image_to_video_prompt, text_to_video_toggle, text_to_video_prompt, video_to_video_toggle, video_to_video_prompt, video_input, text_to_music_toggle, text_to_music_prompt, image_video_to_animation_toggle, animation_mode_dropdown, animation_quality_dropdown, animation_video_input],
9452
- outputs=[code_output, history, sandbox, history_output]
9453
- ).then(
9454
- end_generation_ui,
9455
- inputs=None,
9456
- outputs=[sidebar, generating_status]
9457
- ).then(
9458
- toggle_editors,
9459
- inputs=[language_dropdown, code_output],
9460
- outputs=[code_output, tjs_group, tjs_html_code, tjs_js_code, tjs_css_code]
9461
- ).then(
9462
- toggle_static_editors,
9463
- inputs=[language_dropdown, code_output],
9464
- outputs=[
9465
- code_output,
9466
- static_group_2, static_group_3, static_group_4, static_group_5plus,
9467
- static_tab_2_1, static_code_2_1, static_tab_2_2, static_code_2_2,
9468
- static_tab_3_1, static_code_3_1, static_tab_3_2, static_code_3_2, static_tab_3_3, static_code_3_3,
9469
- static_tab_4_1, static_code_4_1, static_tab_4_2, static_code_4_2, static_tab_4_3, static_code_4_3, static_tab_4_4, static_code_4_4,
9470
- static_tab_5_1, static_code_5_1, static_tab_5_2, static_code_5_2, static_tab_5_3, static_code_5_3, static_tab_5_4, static_code_5_4, static_tab_5_5, static_code_5_5,
9471
- ]
9472
- ).then(
9473
- show_deploy_components,
9474
- None,
9475
- [space_name_input, sdk_dropdown, deploy_btn]
9476
- ).then(
9477
- preserve_space_info_for_followup,
9478
- inputs=[history],
9479
- outputs=[space_name_input, deploy_btn]
9480
- )
9481
-
9482
- # Toggle between classic controls and beta chat UI
9483
- def toggle_beta(checked: bool, t2i: bool, i2i: bool, i2v: bool, t2v: bool, v2v: bool, t2m: bool, iv2a: bool):
9484
- # Prompts only visible in classic mode and when their toggles are on
9485
- t2i_vis = (not checked) and bool(t2i)
9486
- i2i_vis = (not checked) and bool(i2i)
9487
- i2v_vis = (not checked) and bool(i2v)
9488
- t2v_vis = (not checked) and bool(t2v)
9489
- v2v_vis = (not checked) and bool(v2v)
9490
- t2m_vis = (not checked) and bool(t2m)
9491
- iv2a_vis = (not checked) and bool(iv2a)
9492
 
9493
- return (
9494
- # Chat UI group
9495
- gr.update(visible=checked), # sidebar_chatbot
9496
- gr.update(visible=checked), # sidebar_msg
9497
- gr.update(visible=checked), # advanced_commands
9498
- gr.update(visible=checked), # chat_clear_btn
9499
- # Classic controls
9500
- gr.update(visible=not checked), # input
9501
- gr.update(visible=not checked), # language_dropdown
9502
- gr.update(visible=not checked), # website_url_input
9503
- gr.update(visible=not checked), # file_input
9504
- gr.update(visible=not checked), # btn
9505
- gr.update(visible=not checked), # clear_btn
9506
- gr.update(visible=not checked), # search_toggle
9507
- gr.update(visible=not checked), # image_generation_toggle
9508
- gr.update(visible=t2i_vis), # text_to_image_prompt
9509
- gr.update(visible=not checked), # image_to_image_toggle
9510
- gr.update(visible=i2i_vis), # image_to_image_prompt
9511
- gr.update(visible=not checked), # image_to_video_toggle
9512
- gr.update(visible=i2v_vis), # image_to_video_prompt
9513
- gr.update(visible=not checked), # text_to_video_toggle
9514
- gr.update(visible=t2v_vis), # text_to_video_prompt
9515
- gr.update(visible=not checked), # video_to_video_toggle
9516
- gr.update(visible=v2v_vis), # video_to_video_prompt
9517
- gr.update(visible=v2v_vis), # video_input
9518
- gr.update(visible=not checked), # text_to_music_toggle
9519
- gr.update(visible=t2m_vis), # text_to_music_prompt
9520
- gr.update(visible=not checked), # image_video_to_animation_toggle
9521
- gr.update(visible=iv2a_vis), # animation_mode_dropdown
9522
- gr.update(visible=iv2a_vis), # animation_quality_dropdown
9523
- gr.update(visible=iv2a_vis), # animation_video_input
9524
- gr.update(visible=not checked), # model_dropdown
9525
- gr.update(visible=not checked), # quick_start_md
9526
- gr.update(visible=not checked), # quick_examples_col
9527
- )
9528
 
9529
- beta_toggle.change(
9530
- toggle_beta,
9531
- inputs=[beta_toggle, image_generation_toggle, image_to_image_toggle, image_to_video_toggle, text_to_video_toggle, video_to_video_toggle, text_to_music_toggle, image_video_to_animation_toggle],
9532
- outputs=[
9533
- sidebar_chatbot,
9534
- sidebar_msg,
9535
- advanced_commands,
9536
- chat_clear_btn,
9537
- input,
9538
- language_dropdown,
9539
- website_url_input,
9540
- file_input,
9541
- btn,
9542
- clear_btn,
9543
- search_toggle,
9544
- image_generation_toggle,
9545
- text_to_image_prompt,
9546
- image_to_image_toggle,
9547
- image_to_image_prompt,
9548
- image_to_video_toggle,
9549
- image_to_video_prompt,
9550
- text_to_video_toggle,
9551
- text_to_video_prompt,
9552
- video_to_video_toggle,
9553
- video_to_video_prompt,
9554
- video_input,
9555
- text_to_music_toggle,
9556
- text_to_music_prompt,
9557
- image_video_to_animation_toggle,
9558
- animation_mode_dropdown,
9559
- animation_quality_dropdown,
9560
- animation_video_input,
9561
- model_dropdown,
9562
- quick_start_md,
9563
- quick_examples_col,
9564
- ],
9565
- )
9566
  # Update preview when code or language changes (supports multi-file path via optional args)
9567
  code_output.change(preview_logic, inputs=[code_output, language_dropdown, tjs_html_code, tjs_js_code, tjs_css_code], outputs=sandbox)
9568
  language_dropdown.change(preview_logic, inputs=[code_output, language_dropdown, tjs_html_code, tjs_js_code, tjs_css_code], outputs=sandbox)
 
8216
  margin: 8px 0;
8217
  text-align: center;
8218
  }
 
 
 
 
 
 
 
 
8219
  /* Authentication status styling */
8220
  .auth-status {
8221
  padding: 8px 12px;
 
8254
  elem_classes=["auth-status"]
8255
  )
8256
 
 
 
 
 
 
8257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8258
 
8259
  # Collapsed Advanced Commands reference
8260
  with gr.Accordion(label="Advanced Commands", open=False, visible=False) as advanced_commands:
 
8487
 
8488
  # LLM-guided media placement is now always on (no toggle in UI)
8489
 
8490
+ def on_image_to_image_toggle(toggled):
8491
+ vis = bool(toggled)
 
8492
  return gr.update(visible=vis), gr.update(visible=vis)
8493
 
8494
+ def on_text_to_image_toggle(toggled):
8495
+ vis = bool(toggled)
8496
  return gr.update(visible=vis)
8497
 
8498
  image_to_image_toggle.change(
8499
  on_image_to_image_toggle,
8500
+ inputs=[image_to_image_toggle],
8501
  outputs=[generation_image_input, image_to_image_prompt]
8502
  )
8503
+ def on_image_to_video_toggle(toggled):
8504
+ vis = bool(toggled)
8505
  return gr.update(visible=vis), gr.update(visible=vis)
8506
 
8507
  image_to_video_toggle.change(
8508
  on_image_to_video_toggle,
8509
+ inputs=[image_to_video_toggle],
8510
  outputs=[generation_image_input, image_to_video_prompt]
8511
  )
8512
  image_generation_toggle.change(
8513
  on_text_to_image_toggle,
8514
+ inputs=[image_generation_toggle],
8515
  outputs=[text_to_image_prompt]
8516
  )
8517
  text_to_video_toggle.change(
8518
  on_text_to_image_toggle,
8519
+ inputs=[text_to_video_toggle],
8520
  outputs=[text_to_video_prompt]
8521
  )
8522
  video_to_video_toggle.change(
8523
  on_image_to_video_toggle,
8524
+ inputs=[video_to_video_toggle],
8525
  outputs=[video_input, video_to_video_prompt]
8526
  )
8527
  text_to_music_toggle.change(
8528
  on_text_to_image_toggle,
8529
+ inputs=[text_to_music_toggle],
8530
  outputs=[text_to_music_prompt]
8531
  )
8532
 
8533
+ def on_image_video_to_animation_toggle(toggled):
8534
+ vis = bool(toggled)
8535
  return (
8536
  gr.update(visible=vis), # generation_image_input
8537
  gr.update(visible=vis), # animation_mode_dropdown
 
8541
 
8542
  image_video_to_animation_toggle.change(
8543
  on_image_video_to_animation_toggle,
8544
+ inputs=[image_video_to_animation_toggle],
8545
  outputs=[generation_image_input, animation_mode_dropdown, animation_quality_dropdown, animation_video_input]
8546
  )
8547
  model_dropdown = gr.Dropdown(
 
9166
  import re
9167
  match = re.search(r"https?://[^\s]+", text or "")
9168
  return match.group(0) if match else None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9171
  # Update preview when code or language changes (supports multi-file path via optional args)
9172
  code_output.change(preview_logic, inputs=[code_output, language_dropdown, tjs_html_code, tjs_js_code, tjs_css_code], outputs=sandbox)
9173
  language_dropdown.change(preview_logic, inputs=[code_output, language_dropdown, tjs_html_code, tjs_js_code, tjs_css_code], outputs=sandbox)