Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import torch
|
| 2 |
-
torch.jit.script = lambda f: f
|
| 3 |
# General
|
| 4 |
import os
|
| 5 |
from os.path import join as opj
|
| 6 |
import argparse
|
| 7 |
import datetime
|
| 8 |
from pathlib import Path
|
| 9 |
-
import spaces
|
| 10 |
import gradio as gr
|
| 11 |
import tempfile
|
| 12 |
import yaml
|
|
@@ -59,7 +59,7 @@ msxl_model = init_v2v_model(cfg_v2v, devices[3])
|
|
| 59 |
# -------------------------
|
| 60 |
# ----- Functionality -----
|
| 61 |
# -------------------------
|
| 62 |
-
@spaces.GPU(duration=120)
|
| 63 |
def generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, seed, t, image_guidance, where_to_log=result_fol):
|
| 64 |
now = datetime.datetime.now()
|
| 65 |
name = prompt[:100].replace(" ", "_") + "_" + str(now.time()).replace(":", "_").replace(".", "_")
|
|
@@ -89,7 +89,7 @@ def generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, se
|
|
| 89 |
video_path = opj(where_to_log, name+".mp4")
|
| 90 |
return video_path
|
| 91 |
|
| 92 |
-
@spaces.GPU(duration=400)
|
| 93 |
def enhance(prompt, input_to_enhance, num_frames=None, image=None, model_name_stage1=None, model_name_stage2=None, seed=33, t=50, image_guidance=9.5, result_fol=result_fol):
|
| 94 |
if input_to_enhance is None:
|
| 95 |
input_to_enhance = generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, seed, t, image_guidance)
|
|
@@ -176,7 +176,7 @@ with gr.Blocks() as demo:
|
|
| 176 |
with gr.Row():
|
| 177 |
num_frames = gr.Dropdown(["24 - frames", "32 - frames", "40 - frames", "48 - frames", "56 - frames", "80 - recommended to run on local GPUs", "240 - recommended to run on local GPUs", "600 - recommended to run on local GPUs", "1200 - recommended to run on local GPUs", "10000 - recommended to run on local GPUs"], label="Number of Video Frames", info="For >56 frames use local workstation!", value="24 - frames")
|
| 178 |
with gr.Row():
|
| 179 |
-
prompt_stage1 = gr.Textbox(label='Textual Prompt', placeholder="Ex:
|
| 180 |
with gr.Row():
|
| 181 |
image_stage1 = gr.Image(label='Image Prompt (first select Image-to-Video model from advanced options to enable image upload)', show_label=True, scale=1, show_download_button=False, interactive=False)
|
| 182 |
with gr.Column():
|
|
|
|
| 1 |
import torch
|
| 2 |
+
# torch.jit.script = lambda f: f
|
| 3 |
# General
|
| 4 |
import os
|
| 5 |
from os.path import join as opj
|
| 6 |
import argparse
|
| 7 |
import datetime
|
| 8 |
from pathlib import Path
|
| 9 |
+
# import spaces
|
| 10 |
import gradio as gr
|
| 11 |
import tempfile
|
| 12 |
import yaml
|
|
|
|
| 59 |
# -------------------------
|
| 60 |
# ----- Functionality -----
|
| 61 |
# -------------------------
|
| 62 |
+
# @spaces.GPU(duration=120)
|
| 63 |
def generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, seed, t, image_guidance, where_to_log=result_fol):
|
| 64 |
now = datetime.datetime.now()
|
| 65 |
name = prompt[:100].replace(" ", "_") + "_" + str(now.time()).replace(":", "_").replace(".", "_")
|
|
|
|
| 89 |
video_path = opj(where_to_log, name+".mp4")
|
| 90 |
return video_path
|
| 91 |
|
| 92 |
+
# @spaces.GPU(duration=400)
|
| 93 |
def enhance(prompt, input_to_enhance, num_frames=None, image=None, model_name_stage1=None, model_name_stage2=None, seed=33, t=50, image_guidance=9.5, result_fol=result_fol):
|
| 94 |
if input_to_enhance is None:
|
| 95 |
input_to_enhance = generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, seed, t, image_guidance)
|
|
|
|
| 176 |
with gr.Row():
|
| 177 |
num_frames = gr.Dropdown(["24 - frames", "32 - frames", "40 - frames", "48 - frames", "56 - frames", "80 - recommended to run on local GPUs", "240 - recommended to run on local GPUs", "600 - recommended to run on local GPUs", "1200 - recommended to run on local GPUs", "10000 - recommended to run on local GPUs"], label="Number of Video Frames", info="For >56 frames use local workstation!", value="24 - frames")
|
| 178 |
with gr.Row():
|
| 179 |
+
prompt_stage1 = gr.Textbox(label='Textual Prompt', placeholder="Ex: A man with yellow ballon head is riding a bike on the street of New York City", value="A man with yellow ballon head is riding a bike on the street of New York City")
|
| 180 |
with gr.Row():
|
| 181 |
image_stage1 = gr.Image(label='Image Prompt (first select Image-to-Video model from advanced options to enable image upload)', show_label=True, scale=1, show_download_button=False, interactive=False)
|
| 182 |
with gr.Column():
|