Spaces:
Paused
Paused
Julian Bilcke
commited on
Commit
·
f09566f
1
Parent(s):
c7ffa18
tentative attempt at using ZeroGPU
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import os
|
|
| 3 |
import sys
|
| 4 |
import tempfile
|
| 5 |
import shutil
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
import torch
|
| 8 |
import logging
|
|
@@ -480,6 +481,27 @@ def initialize_inference_pipeline():
|
|
| 480 |
logger.info("Inference pipeline initialized successfully")
|
| 481 |
return inference_pipeline
|
| 482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
def generate_avatar_video(
|
| 484 |
reference_image,
|
| 485 |
audio_file,
|
|
|
|
| 3 |
import sys
|
| 4 |
import tempfile
|
| 5 |
import shutil
|
| 6 |
+
import spaces
|
| 7 |
from pathlib import Path
|
| 8 |
import torch
|
| 9 |
import logging
|
|
|
|
| 481 |
logger.info("Inference pipeline initialized successfully")
|
| 482 |
return inference_pipeline
|
| 483 |
|
| 484 |
+
def get_duration(reference_image,
|
| 485 |
+
audio_file,
|
| 486 |
+
text_prompt,
|
| 487 |
+
seed,
|
| 488 |
+
use_random_seed,
|
| 489 |
+
num_steps,
|
| 490 |
+
guidance_scale,
|
| 491 |
+
audio_scale,
|
| 492 |
+
overlap_frames,
|
| 493 |
+
fps,
|
| 494 |
+
silence_duration,
|
| 495 |
+
resolution="720p"):
|
| 496 |
+
if num_steps > 15:
|
| 497 |
+
return 120
|
| 498 |
+
else:
|
| 499 |
+
return 100
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
# this task might too long for ZeroGPU maybe,
|
| 503 |
+
# but I need to try on a H200 to be sure
|
| 504 |
+
@spaces.GPU(duration=get_duration)
|
| 505 |
def generate_avatar_video(
|
| 506 |
reference_image,
|
| 507 |
audio_file,
|