rkps commited on
Commit
711c457
·
verified ·
1 Parent(s): 861e83e

Update lol.py

Browse files
Files changed (1) hide show
  1. lol.py +27 -11
lol.py CHANGED
@@ -6,7 +6,6 @@ Gradio UI для fal.ai модели fal-ai/wan-i2v.
6
 
7
  import base64
8
  import tempfile
9
- import asyncio
10
  import httpx
11
  import gradio as gr
12
  import numpy as np
@@ -55,6 +54,7 @@ async def generate(
55
  steps,
56
  guide_scale,
57
  shift,
 
58
  enable_safety,
59
  enable_expansion,
60
  ):
@@ -75,6 +75,7 @@ async def generate(
75
  "num_inference_steps": steps,
76
  "guide_scale": guide_scale,
77
  "shift": shift,
 
78
  "enable_safety_checker": enable_safety,
79
  "enable_prompt_expansion": enable_expansion,
80
  "aspect_ratio": aspect_ratio,
@@ -91,15 +92,24 @@ async def generate(
91
 
92
  # ---------- UI ---------------------------------------------------------------
93
 
94
- with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft") as demo:
 
 
 
 
 
 
 
 
 
95
  gr.Markdown(
96
  "## Wan-2.1 Image-to-Video\n"
97
  "Введите API-ключ fal.ai и параметры генерации"
98
  )
99
 
100
  with gr.Row():
101
- # Left column for inputs
102
- with gr.Column(scale=3):
103
  api_key = gr.Textbox(
104
  label="FAL API Key", placeholder="sk-...", type="password"
105
  )
@@ -116,7 +126,7 @@ with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft") as demo:
116
  )
117
  negative_prompt = gr.Textbox(
118
  label="Negative prompt",
119
- value="bright colors, overexposed, static, blurred details, subtitles, style, artwork, painting, picture, still, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, malformed limbs, fused fingers, still picture, cluttered background, three legs, many people in the background, walking backwards",
120
  lines=3
121
  )
122
  aspect_ratio = gr.Dropdown(
@@ -124,7 +134,7 @@ with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft") as demo:
124
  value="9:16",
125
  label="Aspect ratio",
126
  )
127
-
128
  with gr.Accordion("Дополнительные настройки", open=False):
129
  with gr.Row():
130
  with gr.Column():
@@ -135,15 +145,20 @@ with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft") as demo:
135
  steps = gr.Slider(10, 50, value=25, step=1, label="num_inference_steps")
136
  guide_scale = gr.Slider(1, 10, value=4, step=1, label="guide_scale")
137
  shift = gr.Slider(0, 12, value=9, step=1, label="shift")
138
-
139
  with gr.Row():
 
 
 
 
 
140
  enable_safety = gr.Checkbox(value=False, label="enable_safety_checker")
141
  enable_expansion = gr.Checkbox(value=False, label="enable_prompt_expansion")
142
-
143
  generate_btn = gr.Button("Generate", variant="primary")
144
-
145
- # Right column for video output
146
- with gr.Column(scale=2):
147
  video_out = gr.Video(label="Result MP4", height=500)
148
 
149
  generate_btn.click(
@@ -160,6 +175,7 @@ with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft") as demo:
160
  steps,
161
  guide_scale,
162
  shift,
 
163
  enable_safety,
164
  enable_expansion,
165
  ],
 
6
 
7
  import base64
8
  import tempfile
 
9
  import httpx
10
  import gradio as gr
11
  import numpy as np
 
54
  steps,
55
  guide_scale,
56
  shift,
57
+ acceleration, # <-- НОВОЕ
58
  enable_safety,
59
  enable_expansion,
60
  ):
 
75
  "num_inference_steps": steps,
76
  "guide_scale": guide_scale,
77
  "shift": shift,
78
+ "acceleration": acceleration, # <-- НОВОЕ
79
  "enable_safety_checker": enable_safety,
80
  "enable_prompt_expansion": enable_expansion,
81
  "aspect_ratio": aspect_ratio,
 
92
 
93
  # ---------- UI ---------------------------------------------------------------
94
 
95
+ NEG_DEF = (
96
+ "bright colors, overexposed, static, blurred details, subtitles, style, "
97
+ "artwork, painting, picture, still, overall gray, worst quality, low quality, "
98
+ "JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, "
99
+ "poorly drawn faces, deformed, disfigured, malformed limbs, fused fingers, "
100
+ "still picture, cluttered background, three legs, many people in the background, "
101
+ "walking backwards"
102
+ )
103
+
104
+ with gr.Blocks(title="Wan-I2V (fal.ai)", theme="soft", fill_width=True, fill_height=True) as demo:
105
  gr.Markdown(
106
  "## Wan-2.1 Image-to-Video\n"
107
  "Введите API-ключ fal.ai и параметры генерации"
108
  )
109
 
110
  with gr.Row():
111
+ # -------- ЛЕВАЯ КОЛОНКА ------------------------------------------------
112
+ with gr.Column(scale=3, min_width=340):
113
  api_key = gr.Textbox(
114
  label="FAL API Key", placeholder="sk-...", type="password"
115
  )
 
126
  )
127
  negative_prompt = gr.Textbox(
128
  label="Negative prompt",
129
+ value=NEG_DEF,
130
  lines=3
131
  )
132
  aspect_ratio = gr.Dropdown(
 
134
  value="9:16",
135
  label="Aspect ratio",
136
  )
137
+
138
  with gr.Accordion("Дополнительные настройки", open=False):
139
  with gr.Row():
140
  with gr.Column():
 
145
  steps = gr.Slider(10, 50, value=25, step=1, label="num_inference_steps")
146
  guide_scale = gr.Slider(1, 10, value=4, step=1, label="guide_scale")
147
  shift = gr.Slider(0, 12, value=9, step=1, label="shift")
148
+
149
  with gr.Row():
150
+ acceleration = gr.Dropdown( # <-- НОВОЕ
151
+ ["none", "regular"],
152
+ value="regular",
153
+ label="acceleration"
154
+ )
155
  enable_safety = gr.Checkbox(value=False, label="enable_safety_checker")
156
  enable_expansion = gr.Checkbox(value=False, label="enable_prompt_expansion")
157
+
158
  generate_btn = gr.Button("Generate", variant="primary")
159
+
160
+ # -------- ПРАВАЯ КОЛОНКА ----------------------------------------------
161
+ with gr.Column(scale=2, min_width=400):
162
  video_out = gr.Video(label="Result MP4", height=500)
163
 
164
  generate_btn.click(
 
175
  steps,
176
  guide_scale,
177
  shift,
178
+ acceleration, # <-- НОВОЕ
179
  enable_safety,
180
  enable_expansion,
181
  ],