Spaces:
Running on Zero
Running on Zero
UI: glass redesign — dark navy bg with ambient glow, glass panels, gradient button, two-column layout
Browse files
app.py
CHANGED
|
@@ -669,140 +669,291 @@ def _update_auto_lora_preview(prompt, auto_lora_enabled):
|
|
| 669 |
return "<b>Auto-activated:</b><ul style='margin:2px 0;padding-left:18px'>" + "".join(items) + "</ul>"
|
| 670 |
|
| 671 |
|
| 672 |
-
|
| 673 |
/* ── Hidden timestamp (preserved) ── */
|
| 674 |
#hidden-timestamp {
|
| 675 |
-
opacity: 0;
|
| 676 |
-
|
| 677 |
-
width: 0px;
|
| 678 |
-
margin: 0px;
|
| 679 |
-
padding: 0px;
|
| 680 |
-
overflow: hidden;
|
| 681 |
-
position: absolute;
|
| 682 |
-
pointer-events: none;
|
| 683 |
}
|
| 684 |
|
| 685 |
-
/* ── BACKGROUND —
|
| 686 |
.gradio-container {
|
| 687 |
-
background:
|
| 688 |
-
#060a1c 0%, #0e1d5c 12%, #14408f 25%,
|
| 689 |
-
#0a7a4e 40%, #12b367 55%, #1f4fa8 65%,
|
| 690 |
-
#5b2bd0 80%, #33107a 100%) !important;
|
| 691 |
-
background-attachment: fixed !important;
|
| 692 |
min-height: 100vh !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 693 |
}
|
| 694 |
|
| 695 |
-
/* ──
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
}
|
| 704 |
|
| 705 |
/* ── GENERATE BUTTON — gradient ── */
|
| 706 |
-
button.primary {
|
| 707 |
background: linear-gradient(135deg, #00b894, #0984e3, #6c5ce7) !important;
|
| 708 |
background-size: 200% 200% !important;
|
| 709 |
-
animation:
|
| 710 |
color: #ffffff !important;
|
| 711 |
font-weight: 700 !important;
|
|
|
|
| 712 |
border: none !important;
|
| 713 |
border-radius: 12px !important;
|
|
|
|
|
|
|
| 714 |
box-shadow: 0 4px 20px rgba(0, 184, 148, 0.35), 0 0 40px rgba(108, 92, 231, 0.15) !important;
|
| 715 |
transition: transform 0.25s ease, box-shadow 0.3s ease !important;
|
| 716 |
cursor: pointer !important;
|
| 717 |
}
|
| 718 |
-
button.primary:hover {
|
| 719 |
transform: translateY(-2px) !important;
|
| 720 |
box-shadow: 0 8px 32px rgba(0, 184, 148, 0.5), 0 0 60px rgba(108, 92, 231, 0.25) !important;
|
| 721 |
}
|
| 722 |
-
|
| 723 |
-
@keyframes btn-shimmer {
|
| 724 |
0%, 100% { background-position: 0% 50%; }
|
| 725 |
50% { background-position: 100% 50%; }
|
| 726 |
}
|
| 727 |
|
| 728 |
-
/* ── CHECKBOXES — teal
|
| 729 |
input[type="checkbox"] {
|
| 730 |
-
accent-color: #
|
| 731 |
}
|
| 732 |
|
| 733 |
-
/* ──
|
| 734 |
-
.gradio-container
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 738 |
}
|
| 739 |
"""
|
| 740 |
|
| 741 |
|
| 742 |
with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
| 743 |
-
|
| 744 |
-
gr.
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 760 |
)
|
| 761 |
-
duration_seconds_input = gr.Slider(minimum=MIN_DURATION, maximum=MAX_DURATION, step=0.1, value=3.5, label="Duration (seconds)", info=f"Clamped to model's {MIN_FRAMES_MODEL}-{MAX_FRAMES_MODEL} frames at {FIXED_FPS}fps.")
|
| 762 |
frame_multi = gr.Dropdown(
|
| 763 |
choices=[FIXED_FPS, FIXED_FPS*2, FIXED_FPS*4, FIXED_FPS*8],
|
| 764 |
-
value=FIXED_FPS,
|
| 765 |
-
label="Video Fluidity (Frames per Second)",
|
| 766 |
-
info="Extra frames will be generated using flow estimation, which estimates motion between frames to make the video smoother."
|
| 767 |
-
)
|
| 768 |
-
safe_mode_checkbox = gr.Checkbox(
|
| 769 |
-
label="🛠️ Safe Mode",
|
| 770 |
-
value=True,
|
| 771 |
-
info="Requests 30% extra processing time to try to prevent unfinished tasks when the server is busy."
|
| 772 |
)
|
|
|
|
| 773 |
with gr.Accordion("Advanced Settings", open=False):
|
| 774 |
-
last_image_component = gr.Image(
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 778 |
randomize_seed_checkbox = gr.Checkbox(label="Randomize seed", value=True, interactive=True)
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
|
|
|
|
|
|
| 782 |
scheduler_dropdown = gr.Dropdown(
|
| 783 |
-
label="Scheduler",
|
| 784 |
-
choices=list(SCHEDULER_MAP.keys()),
|
| 785 |
value="UniPCMultistep",
|
| 786 |
-
info="Select a custom scheduler."
|
| 787 |
)
|
| 788 |
-
|
| 789 |
-
|
|
|
|
|
|
|
| 790 |
play_result_video = gr.Checkbox(label="Display result", value=True, interactive=True)
|
| 791 |
|
| 792 |
-
|
|
|
|
| 793 |
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
|
|
|
|
|
|
|
|
|
| 799 |
with gr.Row():
|
| 800 |
-
grab_frame_btn = gr.Button("
|
| 801 |
timestamp_box = gr.Number(value=0, label="Timestamp", visible=True, elem_id="hidden-timestamp")
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
file_output = gr.File(label="Download Video")
|
| 805 |
|
|
|
|
| 806 |
ui_inputs = [
|
| 807 |
input_image_component, last_image_component, prompt_input, steps_slider,
|
| 808 |
negative_prompt_input, duration_seconds_input,
|
|
@@ -813,14 +964,13 @@ with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
|
| 813 |
auto_lora_checkbox,
|
| 814 |
play_result_video
|
| 815 |
]
|
| 816 |
-
|
| 817 |
generate_button.click(
|
| 818 |
-
fn=generate_video,
|
| 819 |
-
inputs=ui_inputs,
|
| 820 |
outputs=[video_output, file_output, seed_input]
|
| 821 |
)
|
| 822 |
-
|
| 823 |
-
# --- Auto-LoRA Preview Events ---
|
| 824 |
prompt_input.change(
|
| 825 |
fn=_update_auto_lora_preview,
|
| 826 |
inputs=[prompt_input, auto_lora_checkbox],
|
|
@@ -831,17 +981,11 @@ with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
|
| 831 |
inputs=[prompt_input, auto_lora_checkbox],
|
| 832 |
outputs=[auto_lora_preview],
|
| 833 |
)
|
| 834 |
-
|
| 835 |
-
# --- Frame Grabbing Events ---
|
| 836 |
-
# 1. Click button -> JS runs -> puts time in hidden number box
|
| 837 |
grab_frame_btn.click(
|
| 838 |
-
fn=None,
|
| 839 |
-
inputs=None,
|
| 840 |
-
outputs=[timestamp_box],
|
| 841 |
js=get_timestamp_js
|
| 842 |
)
|
| 843 |
-
|
| 844 |
-
# 2. Hidden number box changes -> Python runs -> puts frame in Input Image
|
| 845 |
timestamp_box.change(
|
| 846 |
fn=extract_frame,
|
| 847 |
inputs=[video_output, timestamp_box],
|
|
@@ -850,16 +994,16 @@ with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
|
| 850 |
|
| 851 |
if __name__ == "__main__":
|
| 852 |
theme = gr.themes.Default().set(
|
| 853 |
-
slider_color="#
|
| 854 |
-
slider_color_dark="#
|
| 855 |
-
checkbox_background_color_selected="#
|
| 856 |
-
checkbox_background_color_selected_dark="#
|
| 857 |
-
checkbox_border_color_selected="#
|
| 858 |
-
checkbox_border_color_focus="#
|
| 859 |
)
|
| 860 |
demo.queue().launch(
|
| 861 |
mcp_server=True,
|
| 862 |
-
head=f"<style>{
|
| 863 |
theme=theme,
|
| 864 |
show_error=True,
|
| 865 |
)
|
|
|
|
| 669 |
return "<b>Auto-activated:</b><ul style='margin:2px 0;padding-left:18px'>" + "".join(items) + "</ul>"
|
| 670 |
|
| 671 |
|
| 672 |
+
GLASS_CSS = """
|
| 673 |
/* ── Hidden timestamp (preserved) ── */
|
| 674 |
#hidden-timestamp {
|
| 675 |
+
opacity: 0; height: 0px; width: 0px; margin: 0px; padding: 0px;
|
| 676 |
+
overflow: hidden; position: absolute; pointer-events: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
}
|
| 678 |
|
| 679 |
+
/* ── BACKGROUND — dark navy with ambient glow blobs ── */
|
| 680 |
.gradio-container {
|
| 681 |
+
background: #0a0e1a !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
min-height: 100vh !important;
|
| 683 |
+
position: relative !important;
|
| 684 |
+
overflow-x: hidden !important;
|
| 685 |
+
}
|
| 686 |
+
/* Ambient glow blobs — positioned behind content */
|
| 687 |
+
.gradio-container::before,
|
| 688 |
+
.gradio-container::after {
|
| 689 |
+
content: "" !important;
|
| 690 |
+
position: fixed !important;
|
| 691 |
+
border-radius: 50% !important;
|
| 692 |
+
filter: blur(120px) !important;
|
| 693 |
+
pointer-events: none !important;
|
| 694 |
+
z-index: 0 !important;
|
| 695 |
+
}
|
| 696 |
+
.gradio-container::before {
|
| 697 |
+
width: 500px !important; height: 500px !important;
|
| 698 |
+
left: -100px !important; top: 30% !important;
|
| 699 |
+
background: rgba(0, 201, 167, 0.10) !important;
|
| 700 |
+
}
|
| 701 |
+
.gradio-container::after {
|
| 702 |
+
width: 600px !important; height: 600px !important;
|
| 703 |
+
right: -150px !important; top: 10% !important;
|
| 704 |
+
background: rgba(168, 85, 247, 0.12) !important;
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
/* ── GLASS PANELS ── */
|
| 708 |
+
.gradio-container .block {
|
| 709 |
+
background: rgba(15, 20, 35, 0.60) !important;
|
| 710 |
+
backdrop-filter: blur(20px) !important;
|
| 711 |
+
-webkit-backdrop-filter: blur(20px) !important;
|
| 712 |
+
border: 1px solid rgba(255, 255, 255, 0.08) !important;
|
| 713 |
+
border-radius: 16px !important;
|
| 714 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
/* ── SECTION LABELS — uppercase teal ── */
|
| 718 |
+
.glass-label {
|
| 719 |
+
font-size: 11px !important;
|
| 720 |
+
font-weight: 700 !important;
|
| 721 |
+
text-transform: uppercase !important;
|
| 722 |
+
letter-spacing: 1.5px !important;
|
| 723 |
+
color: rgba(94, 234, 212, 0.8) !important;
|
| 724 |
+
margin-bottom: 8px !important;
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
/* ── TITLE / SUBTITLE — outside glass ── */
|
| 728 |
+
.glass-title {
|
| 729 |
+
font-size: 28px !important;
|
| 730 |
+
font-weight: 700 !important;
|
| 731 |
+
color: #ffffff !important;
|
| 732 |
+
margin-bottom: 6px !important;
|
| 733 |
+
}
|
| 734 |
+
.glass-subtitle {
|
| 735 |
+
font-size: 14px !important;
|
| 736 |
+
color: rgba(255, 255, 255, 0.50) !important;
|
| 737 |
+
margin-bottom: 20px !important;
|
| 738 |
}
|
| 739 |
|
| 740 |
+
/* ── TEXTAREA — dark transparent ── */
|
| 741 |
+
textarea {
|
| 742 |
+
background: rgba(0, 0, 0, 0.25) !important;
|
| 743 |
+
border: 1px solid rgba(255, 255, 255, 0.10) !important;
|
| 744 |
+
border-radius: 10px !important;
|
| 745 |
+
color: #e2e8f0 !important;
|
| 746 |
+
font-size: 15px !important;
|
| 747 |
+
}
|
| 748 |
+
textarea:focus {
|
| 749 |
+
border-color: rgba(94, 234, 212, 0.4) !important;
|
| 750 |
+
box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.1) !important;
|
| 751 |
+
outline: none !important;
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
/* ── SLIDERS — teal accent via theme + pseudo-elements ── */
|
| 755 |
+
input[data-testid="range-input"]::-webkit-slider-thumb {
|
| 756 |
+
-webkit-appearance: none !important;
|
| 757 |
+
appearance: none !important;
|
| 758 |
+
width: 16px !important; height: 16px !important;
|
| 759 |
+
border-radius: 50% !important;
|
| 760 |
+
background: #5eead4 !important;
|
| 761 |
+
border: 2px solid rgba(255, 255, 255, 0.3) !important;
|
| 762 |
+
box-shadow: 0 0 8px rgba(94, 234, 212, 0.4) !important;
|
| 763 |
+
cursor: pointer !important;
|
| 764 |
+
}
|
| 765 |
+
input[data-testid="range-input"]::-moz-range-thumb {
|
| 766 |
+
width: 16px !important; height: 16px !important;
|
| 767 |
+
border-radius: 50% !important;
|
| 768 |
+
background: #5eead4 !important;
|
| 769 |
+
border: 2px solid rgba(255, 255, 255, 0.3) !important;
|
| 770 |
+
box-shadow: 0 0 8px rgba(94, 234, 212, 0.4) !important;
|
| 771 |
+
cursor: pointer !important;
|
| 772 |
}
|
| 773 |
|
| 774 |
/* ── GENERATE BUTTON — gradient ── */
|
| 775 |
+
button.primary, #glass-generate-btn button {
|
| 776 |
background: linear-gradient(135deg, #00b894, #0984e3, #6c5ce7) !important;
|
| 777 |
background-size: 200% 200% !important;
|
| 778 |
+
animation: glass-shimmer 4s ease-in-out infinite !important;
|
| 779 |
color: #ffffff !important;
|
| 780 |
font-weight: 700 !important;
|
| 781 |
+
font-size: 16px !important;
|
| 782 |
border: none !important;
|
| 783 |
border-radius: 12px !important;
|
| 784 |
+
padding: 14px 32px !important;
|
| 785 |
+
width: 100% !important;
|
| 786 |
box-shadow: 0 4px 20px rgba(0, 184, 148, 0.35), 0 0 40px rgba(108, 92, 231, 0.15) !important;
|
| 787 |
transition: transform 0.25s ease, box-shadow 0.3s ease !important;
|
| 788 |
cursor: pointer !important;
|
| 789 |
}
|
| 790 |
+
button.primary:hover, #glass-generate-btn button:hover {
|
| 791 |
transform: translateY(-2px) !important;
|
| 792 |
box-shadow: 0 8px 32px rgba(0, 184, 148, 0.5), 0 0 60px rgba(108, 92, 231, 0.25) !important;
|
| 793 |
}
|
| 794 |
+
@keyframes glass-shimmer {
|
|
|
|
| 795 |
0%, 100% { background-position: 0% 50%; }
|
| 796 |
50% { background-position: 100% 50%; }
|
| 797 |
}
|
| 798 |
|
| 799 |
+
/* ── CHECKBOXES — teal ── */
|
| 800 |
input[type="checkbox"] {
|
| 801 |
+
accent-color: #5eead4 !important;
|
| 802 |
}
|
| 803 |
|
| 804 |
+
/* ── LABELS — light on dark ── */
|
| 805 |
+
.gradio-container label {
|
| 806 |
+
color: rgba(255, 255, 255, 0.75) !important;
|
| 807 |
+
font-size: 13px !important;
|
| 808 |
+
}
|
| 809 |
+
.gradio-container .prose small,
|
| 810 |
+
.gradio-container small {
|
| 811 |
+
color: rgba(255, 255, 255, 0.40) !important;
|
| 812 |
+
}
|
| 813 |
+
|
| 814 |
+
/* ── DROPDOWNS — dark glass ── */
|
| 815 |
+
.gradio-container .dropdown {
|
| 816 |
+
background: rgba(10, 14, 30, 0.7) !important;
|
| 817 |
+
border: 1px solid rgba(255, 255, 255, 0.10) !important;
|
| 818 |
+
border-radius: 8px !important;
|
| 819 |
+
color: #e2e8f0 !important;
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
/* ── ACCORDION — glass header ── */
|
| 823 |
+
.gradio-container .label-wrap {
|
| 824 |
+
background: rgba(255, 255, 255, 0.03) !important;
|
| 825 |
+
border: 1px solid rgba(255, 255, 255, 0.08) !important;
|
| 826 |
+
border-radius: 12px !important;
|
| 827 |
+
color: rgba(255, 255, 255, 0.75) !important;
|
| 828 |
+
font-weight: 600 !important;
|
| 829 |
+
}
|
| 830 |
+
.gradio-container .label-wrap:hover {
|
| 831 |
+
color: #5eead4 !important;
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
/* ── SECONDARY BUTTON — glass ── */
|
| 835 |
+
button.secondary {
|
| 836 |
+
background: rgba(255, 255, 255, 0.06) !important;
|
| 837 |
+
backdrop-filter: blur(8px) !important;
|
| 838 |
+
border: 1px solid rgba(255, 255, 255, 0.10) !important;
|
| 839 |
+
color: rgba(255, 255, 255, 0.75) !important;
|
| 840 |
+
border-radius: 10px !important;
|
| 841 |
+
}
|
| 842 |
+
button.secondary:hover {
|
| 843 |
+
background: rgba(94, 234, 212, 0.10) !important;
|
| 844 |
+
border-color: rgba(94, 234, 212, 0.3) !important;
|
| 845 |
+
color: #5eead4 !important;
|
| 846 |
+
}
|
| 847 |
+
|
| 848 |
+
/* ── PREVIEW PANEL — right column styling ── */
|
| 849 |
+
#preview-panel .block {
|
| 850 |
+
min-height: 400px !important;
|
| 851 |
+
display: flex !important;
|
| 852 |
+
flex-direction: column !important;
|
| 853 |
+
justify-content: center !important;
|
| 854 |
+
}
|
| 855 |
+
|
| 856 |
+
/* ── IMAGE UPLOAD — dashed glass ── */
|
| 857 |
+
[data-testid="image"] {
|
| 858 |
+
border: 2px dashed rgba(255, 255, 255, 0.12) !important;
|
| 859 |
+
border-radius: 12px !important;
|
| 860 |
+
background: rgba(0, 0, 0, 0.15) !important;
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
/* ── HEADER MARKDOWN — transparent bg ── */
|
| 864 |
+
.gradio-container .prose {
|
| 865 |
+
background: transparent !important;
|
| 866 |
}
|
| 867 |
"""
|
| 868 |
|
| 869 |
|
| 870 |
with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
| 871 |
+
# ── TITLE & SUBTITLE — outside glass ──
|
| 872 |
+
gr.HTML("<div class='glass-title'>Wan 2.2 I2V 14B Lightning — NSFW</div>")
|
| 873 |
+
gr.HTML("<div class='glass-subtitle'>Run Wan 2.2 in just 4-8 steps, fp8 quantization & AoT compilation — compatible with diffusers and ZeroGPU</div>")
|
| 874 |
+
|
| 875 |
+
with gr.Row(equal_height=False):
|
| 876 |
+
# ═══════════════ LEFT COLUMN — INPUTS ═══════════════
|
| 877 |
+
with gr.Column(scale=4):
|
| 878 |
+
with gr.Group():
|
| 879 |
+
gr.HTML("<div class='glass-label'>Prompt</div>")
|
| 880 |
+
prompt_input = gr.Textbox(
|
| 881 |
+
label="", value=default_prompt_i2v, lines=4,
|
| 882 |
+
show_label=False, placeholder="Describe the motion you want...",
|
| 883 |
+
)
|
| 884 |
+
auto_lora_preview = gr.HTML(
|
| 885 |
+
value="", elem_id="auto-lora-preview",
|
| 886 |
+
)
|
| 887 |
+
|
| 888 |
+
with gr.Group():
|
| 889 |
+
input_image_component = gr.Image(
|
| 890 |
+
type="pil", label="Input Image",
|
| 891 |
+
sources=["upload", "clipboard"],
|
| 892 |
+
)
|
| 893 |
+
|
| 894 |
+
with gr.Row():
|
| 895 |
+
auto_lora_checkbox = gr.Checkbox(
|
| 896 |
+
label="Auto-activate LoRAs",
|
| 897 |
+
value=True, interactive=True,
|
| 898 |
+
)
|
| 899 |
+
safe_mode_checkbox = gr.Checkbox(
|
| 900 |
+
label="Safe Mode",
|
| 901 |
+
value=True, interactive=True,
|
| 902 |
+
)
|
| 903 |
+
|
| 904 |
+
duration_seconds_input = gr.Slider(
|
| 905 |
+
minimum=MIN_DURATION, maximum=MAX_DURATION,
|
| 906 |
+
step=0.1, value=3.5, label="Duration (seconds)",
|
| 907 |
)
|
|
|
|
| 908 |
frame_multi = gr.Dropdown(
|
| 909 |
choices=[FIXED_FPS, FIXED_FPS*2, FIXED_FPS*4, FIXED_FPS*8],
|
| 910 |
+
value=FIXED_FPS, label="Fluidity (FPS)",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
)
|
| 912 |
+
|
| 913 |
with gr.Accordion("Advanced Settings", open=False):
|
| 914 |
+
last_image_component = gr.Image(
|
| 915 |
+
type="pil", label="Last Image (Optional)",
|
| 916 |
+
sources=["upload", "clipboard"],
|
| 917 |
+
)
|
| 918 |
+
negative_prompt_input = gr.Textbox(
|
| 919 |
+
label="Negative Prompt", value=default_negative_prompt, lines=2,
|
| 920 |
+
)
|
| 921 |
+
with gr.Row():
|
| 922 |
+
quality_slider = gr.Slider(minimum=1, maximum=10, step=1, value=6, label="Quality")
|
| 923 |
+
seed_input = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42, interactive=True)
|
| 924 |
randomize_seed_checkbox = gr.Checkbox(label="Randomize seed", value=True, interactive=True)
|
| 925 |
+
with gr.Row():
|
| 926 |
+
steps_slider = gr.Slider(minimum=1, maximum=30, step=1, value=6, label="Steps")
|
| 927 |
+
flow_shift_slider = gr.Slider(minimum=0.5, maximum=15.0, step=0.1, value=3.0, label="Flow Shift")
|
| 928 |
+
guidance_scale_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=1, label="Guidance Scale — high noise")
|
| 929 |
+
guidance_scale_2_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=1, label="Guidance Scale 2 — low noise")
|
| 930 |
scheduler_dropdown = gr.Dropdown(
|
| 931 |
+
label="Scheduler", choices=list(SCHEDULER_MAP.keys()),
|
|
|
|
| 932 |
value="UniPCMultistep",
|
|
|
|
| 933 |
)
|
| 934 |
+
lora_dropdown = gr.Dropdown(
|
| 935 |
+
choices=lora_loader.get_lora_choices(),
|
| 936 |
+
label="LoRA (NSFW)", multiselect=True,
|
| 937 |
+
)
|
| 938 |
play_result_video = gr.Checkbox(label="Display result", value=True, interactive=True)
|
| 939 |
|
| 940 |
+
with gr.Group(elem_id="glass-generate-btn"):
|
| 941 |
+
generate_button = gr.Button("Generate Video", variant="primary")
|
| 942 |
|
| 943 |
+
# ═══════════════ RIGHT COLUMN — PREVIEW ═══════════════
|
| 944 |
+
with gr.Column(scale=6, elem_id="preview-panel"):
|
| 945 |
+
gr.HTML("<div class='glass-label'>Preview</div>")
|
| 946 |
+
video_output = gr.Video(
|
| 947 |
+
label="", autoplay=True, sources=["upload"],
|
| 948 |
+
buttons=["download", "share"], interactive=True,
|
| 949 |
+
elem_id="generated-video",
|
| 950 |
+
)
|
| 951 |
with gr.Row():
|
| 952 |
+
grab_frame_btn = gr.Button("Use Current Frame as Input", variant="secondary")
|
| 953 |
timestamp_box = gr.Number(value=0, label="Timestamp", visible=True, elem_id="hidden-timestamp")
|
| 954 |
+
file_output = gr.File(label="Download")
|
|
|
|
|
|
|
| 955 |
|
| 956 |
+
# ═══════════════ EVENT WIRING (identical to app.py) ═══════════════
|
| 957 |
ui_inputs = [
|
| 958 |
input_image_component, last_image_component, prompt_input, steps_slider,
|
| 959 |
negative_prompt_input, duration_seconds_input,
|
|
|
|
| 964 |
auto_lora_checkbox,
|
| 965 |
play_result_video
|
| 966 |
]
|
| 967 |
+
|
| 968 |
generate_button.click(
|
| 969 |
+
fn=generate_video,
|
| 970 |
+
inputs=ui_inputs,
|
| 971 |
outputs=[video_output, file_output, seed_input]
|
| 972 |
)
|
| 973 |
+
|
|
|
|
| 974 |
prompt_input.change(
|
| 975 |
fn=_update_auto_lora_preview,
|
| 976 |
inputs=[prompt_input, auto_lora_checkbox],
|
|
|
|
| 981 |
inputs=[prompt_input, auto_lora_checkbox],
|
| 982 |
outputs=[auto_lora_preview],
|
| 983 |
)
|
| 984 |
+
|
|
|
|
|
|
|
| 985 |
grab_frame_btn.click(
|
| 986 |
+
fn=None, inputs=None, outputs=[timestamp_box],
|
|
|
|
|
|
|
| 987 |
js=get_timestamp_js
|
| 988 |
)
|
|
|
|
|
|
|
| 989 |
timestamp_box.change(
|
| 990 |
fn=extract_frame,
|
| 991 |
inputs=[video_output, timestamp_box],
|
|
|
|
| 994 |
|
| 995 |
if __name__ == "__main__":
|
| 996 |
theme = gr.themes.Default().set(
|
| 997 |
+
slider_color="#5eead4",
|
| 998 |
+
slider_color_dark="#5eead4",
|
| 999 |
+
checkbox_background_color_selected="#5eead4",
|
| 1000 |
+
checkbox_background_color_selected_dark="#5eead4",
|
| 1001 |
+
checkbox_border_color_selected="#5eead4",
|
| 1002 |
+
checkbox_border_color_focus="#5eead4",
|
| 1003 |
)
|
| 1004 |
demo.queue().launch(
|
| 1005 |
mcp_server=True,
|
| 1006 |
+
head=f"<style>{GLASS_CSS}</style>",
|
| 1007 |
theme=theme,
|
| 1008 |
show_error=True,
|
| 1009 |
)
|