Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,7 +164,7 @@ def center_crop_resize(input_video_path, target_width=720, target_height=480):
|
|
| 164 |
return temp_video_path
|
| 165 |
|
| 166 |
|
| 167 |
-
|
| 168 |
def infer(
|
| 169 |
prompt: str,
|
| 170 |
num_inference_steps: int,
|
|
@@ -174,6 +174,7 @@ def infer(
|
|
| 174 |
):
|
| 175 |
if seed == -1:
|
| 176 |
seed = random.randint(0, 2**8 - 1)
|
|
|
|
| 177 |
pipe.to(device)
|
| 178 |
video_pt = pipe(
|
| 179 |
prompt=prompt + ", isolated background",
|
|
@@ -278,7 +279,7 @@ with gr.Blocks() as demo:
|
|
| 278 |
download_alpha_video_button = gr.File(label="📥 Download Alpha Video", visible=False)
|
| 279 |
seed_text = gr.Number(label="Seed Used for Video Generation", visible=False)
|
| 280 |
|
| 281 |
-
|
| 282 |
def generate(
|
| 283 |
prompt,
|
| 284 |
seed_value,
|
|
|
|
| 164 |
return temp_video_path
|
| 165 |
|
| 166 |
|
| 167 |
+
@spaces.GPU(duration=120)
|
| 168 |
def infer(
|
| 169 |
prompt: str,
|
| 170 |
num_inference_steps: int,
|
|
|
|
| 174 |
):
|
| 175 |
if seed == -1:
|
| 176 |
seed = random.randint(0, 2**8 - 1)
|
| 177 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 178 |
pipe.to(device)
|
| 179 |
video_pt = pipe(
|
| 180 |
prompt=prompt + ", isolated background",
|
|
|
|
| 279 |
download_alpha_video_button = gr.File(label="📥 Download Alpha Video", visible=False)
|
| 280 |
seed_text = gr.Number(label="Seed Used for Video Generation", visible=False)
|
| 281 |
|
| 282 |
+
@spaces.GPU(duration=120)
|
| 283 |
def generate(
|
| 284 |
prompt,
|
| 285 |
seed_value,
|