VictorKai1996NUS
commited on
Commit
•
a6d5f16
1
Parent(s):
a3d5451
Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ from videosys.models.cogvideo.pipeline import CogVideoPABConfig
|
|
14 |
import psutil
|
15 |
import GPUtil
|
16 |
|
17 |
-
import threading
|
18 |
-
task_running = threading.Event()
|
19 |
|
20 |
|
21 |
|
@@ -263,16 +263,16 @@ with gr.Blocks(css=css) as demo:
|
|
263 |
|
264 |
|
265 |
|
266 |
-
def run_task(func, *args):
|
267 |
-
|
268 |
-
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
|
277 |
def generate_vanilla(prompt, num_inference_steps, guidance_scale, progress=gr.Progress(track_tqdm=True)):
|
278 |
engine = load_model()
|
@@ -306,7 +306,7 @@ with gr.Blocks(css=css) as demo:
|
|
306 |
try:
|
307 |
gpus = GPUtil.getGPUs()
|
308 |
if gpus:
|
309 |
-
gpu = gpus[0]
|
310 |
gpu_memory = f"{gpu.memoryUsed}/{gpu.memoryTotal}MB ({gpu.memoryUtil*100:.1f}%)"
|
311 |
else:
|
312 |
gpu_memory = "No GPU found"
|
@@ -332,25 +332,18 @@ with gr.Blocks(css=css) as demo:
|
|
332 |
|
333 |
|
334 |
generate_button.click(
|
335 |
-
|
336 |
-
inputs=[
|
337 |
-
outputs=[
|
338 |
-
gr.Group([video_output, download_video_button, elapsed_time]),
|
339 |
-
task_status,
|
340 |
-
gr.Group([generate_button, generate_button_vs])
|
341 |
-
]
|
342 |
)
|
343 |
|
344 |
generate_button_vs.click(
|
345 |
-
|
346 |
-
inputs=[
|
347 |
-
outputs=[
|
348 |
-
gr.Group([video_output_vs, download_video_button_vs, elapsed_time_vs]),
|
349 |
-
task_status,
|
350 |
-
gr.Group([generate_button, generate_button_vs])
|
351 |
-
]
|
352 |
)
|
353 |
|
|
|
354 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
355 |
|
356 |
|
|
|
14 |
import psutil
|
15 |
import GPUtil
|
16 |
|
17 |
+
# import threading
|
18 |
+
# task_running = threading.Event()
|
19 |
|
20 |
|
21 |
|
|
|
263 |
|
264 |
|
265 |
|
266 |
+
# def run_task(func, *args):
|
267 |
+
# if task_running.is_set():
|
268 |
+
# return None, gr.update(value="Please wait for another running end", visible=True), gr.update(visible=False)
|
269 |
|
270 |
+
# task_running.set()
|
271 |
+
# try:
|
272 |
+
# result = func(*args)
|
273 |
+
# return result, gr.update(visible=False), gr.update(visible=True)
|
274 |
+
# finally:
|
275 |
+
# task_running.clear()
|
276 |
|
277 |
def generate_vanilla(prompt, num_inference_steps, guidance_scale, progress=gr.Progress(track_tqdm=True)):
|
278 |
engine = load_model()
|
|
|
306 |
try:
|
307 |
gpus = GPUtil.getGPUs()
|
308 |
if gpus:
|
309 |
+
gpu = gpus[0]
|
310 |
gpu_memory = f"{gpu.memoryUsed}/{gpu.memoryTotal}MB ({gpu.memoryUtil*100:.1f}%)"
|
311 |
else:
|
312 |
gpu_memory = "No GPU found"
|
|
|
332 |
|
333 |
|
334 |
generate_button.click(
|
335 |
+
generate_vanilla,
|
336 |
+
inputs=[prompt, num_inference_steps, guidance_scale],
|
337 |
+
outputs=[video_output, download_video_button, elapsed_time],
|
|
|
|
|
|
|
|
|
338 |
)
|
339 |
|
340 |
generate_button_vs.click(
|
341 |
+
generate_vs,
|
342 |
+
inputs=[prompt, num_inference_steps, guidance_scale, pab_threshold, pab_gap],
|
343 |
+
outputs=[video_output_vs, download_video_button_vs, elapsed_time_vs],
|
|
|
|
|
|
|
|
|
344 |
)
|
345 |
|
346 |
+
|
347 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
348 |
|
349 |
|