Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -112,8 +112,6 @@ def generate(
|
|
112 |
seed: int = -1,
|
113 |
num_inference_steps: int = 10,
|
114 |
num_frames: int = 30,
|
115 |
-
shape_height: int = 512,
|
116 |
-
shape_width: int = 512,
|
117 |
height: int = 512,
|
118 |
width: int = 512,
|
119 |
animatediff_batch_size: int = 32,
|
@@ -136,7 +134,7 @@ def generate(
|
|
136 |
if selected == "ExVideo" and image_in:
|
137 |
image = Image.open(image_in)
|
138 |
video = pipe(
|
139 |
-
input_image=image.resize((
|
140 |
num_frames=num_frames,
|
141 |
fps=fps_id,
|
142 |
height=height,
|
@@ -151,7 +149,7 @@ def generate(
|
|
151 |
elif selected == "Diffutoon" and video_in:
|
152 |
up_video = VideoData(
|
153 |
video_file=video_in,
|
154 |
-
height=
|
155 |
input_video = [up_video[i] for i in range(1, num_frames)]
|
156 |
|
157 |
video = pipe2(
|
@@ -192,7 +190,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
192 |
gr.HTML("<h1><center>Exvideo📽️Diffutoon</center></h1>")
|
193 |
gr.HTML("""
|
194 |
<p><center>Exvideo and Diffutoon video generation
|
195 |
-
<br><b>Update</b>:
|
196 |
<br><b>Note</b>: ZeroGPU limited, Set the parameters appropriately.</center></p>
|
197 |
""")
|
198 |
with gr.Row():
|
@@ -228,33 +226,16 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
228 |
minimum=1,
|
229 |
maximum=128,
|
230 |
)
|
231 |
-
with gr.Row():
|
232 |
-
shape_height = gr.Slider(
|
233 |
-
label="Shape Height",
|
234 |
-
info="Resize Height",
|
235 |
-
step=8,
|
236 |
-
value=512,
|
237 |
-
minimum=256,
|
238 |
-
maximum=2560,
|
239 |
-
)
|
240 |
-
shape_width = gr.Slider(
|
241 |
-
label="Shape Width",
|
242 |
-
info="Resize Width",
|
243 |
-
step=8,
|
244 |
-
value=512,
|
245 |
-
minimum=256,
|
246 |
-
maximum=2560,
|
247 |
-
)
|
248 |
with gr.Row():
|
249 |
height = gr.Slider(
|
250 |
-
label="
|
251 |
step=8,
|
252 |
value=512,
|
253 |
minimum=256,
|
254 |
maximum=2560,
|
255 |
)
|
256 |
width = gr.Slider(
|
257 |
-
label="
|
258 |
step=8,
|
259 |
value=512,
|
260 |
minimum=256,
|
@@ -308,7 +289,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
308 |
)
|
309 |
selected.change(change_media, inputs=[image_in, video_in, selected], outputs=[image_in, video_in, prompt])
|
310 |
video_in.upload(update_frames, inputs=[video_in], outputs=[num_frames])
|
311 |
-
submit_event = submit_btn.click(fn=generate, inputs=[video_in, image_in, selected, prompt, seed, num_inference_steps, num_frames,
|
312 |
#stop_btn.click(fn=None, inputs=None, outputs=None, cancels=[submit_event])
|
313 |
|
314 |
demo.queue().launch()
|
|
|
112 |
seed: int = -1,
|
113 |
num_inference_steps: int = 10,
|
114 |
num_frames: int = 30,
|
|
|
|
|
115 |
height: int = 512,
|
116 |
width: int = 512,
|
117 |
animatediff_batch_size: int = 32,
|
|
|
134 |
if selected == "ExVideo" and image_in:
|
135 |
image = Image.open(image_in)
|
136 |
video = pipe(
|
137 |
+
input_image=image.resize((width, height)),
|
138 |
num_frames=num_frames,
|
139 |
fps=fps_id,
|
140 |
height=height,
|
|
|
149 |
elif selected == "Diffutoon" and video_in:
|
150 |
up_video = VideoData(
|
151 |
video_file=video_in,
|
152 |
+
height=height, width=width)
|
153 |
input_video = [up_video[i] for i in range(1, num_frames)]
|
154 |
|
155 |
video = pipe2(
|
|
|
190 |
gr.HTML("<h1><center>Exvideo📽️Diffutoon</center></h1>")
|
191 |
gr.HTML("""
|
192 |
<p><center>Exvideo and Diffutoon video generation
|
193 |
+
<br><b>Update</b>: Output resize, Frames length control.
|
194 |
<br><b>Note</b>: ZeroGPU limited, Set the parameters appropriately.</center></p>
|
195 |
""")
|
196 |
with gr.Row():
|
|
|
226 |
minimum=1,
|
227 |
maximum=128,
|
228 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
with gr.Row():
|
230 |
height = gr.Slider(
|
231 |
+
label="Height",
|
232 |
step=8,
|
233 |
value=512,
|
234 |
minimum=256,
|
235 |
maximum=2560,
|
236 |
)
|
237 |
width = gr.Slider(
|
238 |
+
label="Width",
|
239 |
step=8,
|
240 |
value=512,
|
241 |
minimum=256,
|
|
|
289 |
)
|
290 |
selected.change(change_media, inputs=[image_in, video_in, selected], outputs=[image_in, video_in, prompt])
|
291 |
video_in.upload(update_frames, inputs=[video_in], outputs=[num_frames])
|
292 |
+
submit_event = submit_btn.click(fn=generate, inputs=[video_in, image_in, selected, prompt, seed, num_inference_steps, num_frames, height, width, animatediff_batch_size, animatediff_stride, motion_bucket_id, fps_id], outputs=[video, seed], api_name="video")
|
293 |
#stop_btn.click(fn=None, inputs=None, outputs=None, cancels=[submit_event])
|
294 |
|
295 |
demo.queue().launch()
|