VictorKai1996NUS
commited on
Commit
•
debb23f
1
Parent(s):
31f8e54
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,6 @@ from videosys.models.cogvideo.pipeline import CogVideoPABConfig
|
|
14 |
import psutil
|
15 |
import GPUtil
|
16 |
|
17 |
-
import threading
|
18 |
-
|
19 |
-
# tracking the task status
|
20 |
-
task_running = threading.Event()
|
21 |
|
22 |
|
23 |
logging.basicConfig(level=logging.INFO)
|
@@ -320,22 +316,6 @@ with gr.Blocks(css=css) as demo:
|
|
320 |
status['gpu_memory']
|
321 |
)
|
322 |
|
323 |
-
def check_task_status():
|
324 |
-
if task_running.is_set():
|
325 |
-
return gr.update(value="Please wait for the previous running end", visible=True)
|
326 |
-
return gr.update(value="", visible=False)
|
327 |
-
|
328 |
-
def run_task(func, *args):
|
329 |
-
if task_running.is_set():
|
330 |
-
return None, gr.update(value="Please wait for the previous running end", visible=True), gr.update(visible=False)
|
331 |
-
|
332 |
-
task_running.set()
|
333 |
-
try:
|
334 |
-
result = func(*args)
|
335 |
-
return result, gr.update(visible=False), gr.update(visible=True)
|
336 |
-
finally:
|
337 |
-
task_running.clear()
|
338 |
-
|
339 |
# click events
|
340 |
generate_button.click(
|
341 |
run_task,
|
@@ -347,19 +327,17 @@ with gr.Blocks(css=css) as demo:
|
|
347 |
]
|
348 |
)
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
inputs=[
|
353 |
-
outputs=[
|
354 |
-
gr.Group([video_output_vs, download_video_button_vs, elapsed_time_vs]),
|
355 |
-
task_status,
|
356 |
-
gr.Group([generate_button, generate_button_vs])
|
357 |
-
]
|
358 |
)
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
|
|
|
|
|
363 |
|
364 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
365 |
|
|
|
14 |
import psutil
|
15 |
import GPUtil
|
16 |
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
logging.basicConfig(level=logging.INFO)
|
|
|
316 |
status['gpu_memory']
|
317 |
)
|
318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
# click events
|
320 |
generate_button.click(
|
321 |
run_task,
|
|
|
327 |
]
|
328 |
)
|
329 |
|
330 |
+
generate_button.click(
|
331 |
+
generate_vanilla,
|
332 |
+
inputs=[prompt, num_inference_steps, guidance_scale],
|
333 |
+
outputs=[video_output, download_video_button, elapsed_time],
|
|
|
|
|
|
|
|
|
334 |
)
|
335 |
|
336 |
+
generate_button_vs.click(
|
337 |
+
generate_vs,
|
338 |
+
inputs=[prompt, num_inference_steps, guidance_scale, pab_threshold, pab_gap],
|
339 |
+
outputs=[video_output_vs, download_video_button_vs, elapsed_time_vs],
|
340 |
+
)
|
341 |
|
342 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
343 |
|