Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ parser.add_argument('--public_access', action='store_true', default=True)
|
|
| 24 |
parser.add_argument('--where_to_log', type=str, default="gradio_output")
|
| 25 |
parser.add_argument('--device', type=str, default="cuda")
|
| 26 |
args = parser.parse_args()
|
| 27 |
-
|
| 28 |
|
| 29 |
Path(args.where_to_log).mkdir(parents=True, exist_ok=True)
|
| 30 |
result_fol = Path(args.where_to_log).absolute()
|
|
@@ -70,6 +70,9 @@ def generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, se
|
|
| 70 |
num_frames = int(num_frames.split(" ")[0])
|
| 71 |
if num_frames > 56:
|
| 72 |
num_frames = 56
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
n_autoreg_gen = (num_frames-8)//8
|
| 75 |
|
|
@@ -91,6 +94,9 @@ def generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, se
|
|
| 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)
|
| 96 |
encoded_video = video2video(prompt, input_to_enhance, result_fol, cfg_v2v, msxl_model)
|
|
@@ -176,7 +182,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():
|
|
|
|
| 24 |
parser.add_argument('--where_to_log', type=str, default="gradio_output")
|
| 25 |
parser.add_argument('--device', type=str, default="cuda")
|
| 26 |
args = parser.parse_args()
|
| 27 |
+
default_prompt = "A man with yellow ballon head is riding a bike on the street of New York City"
|
| 28 |
|
| 29 |
Path(args.where_to_log).mkdir(parents=True, exist_ok=True)
|
| 30 |
result_fol = Path(args.where_to_log).absolute()
|
|
|
|
| 70 |
num_frames = int(num_frames.split(" ")[0])
|
| 71 |
if num_frames > 56:
|
| 72 |
num_frames = 56
|
| 73 |
+
|
| 74 |
+
if prompt == "" or prompt is None:
|
| 75 |
+
prompt = default_prompt
|
| 76 |
|
| 77 |
n_autoreg_gen = (num_frames-8)//8
|
| 78 |
|
|
|
|
| 94 |
|
| 95 |
# @spaces.GPU(duration=400)
|
| 96 |
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):
|
| 97 |
+
if prompt == "" or prompt is None:
|
| 98 |
+
prompt = default_prompt
|
| 99 |
+
|
| 100 |
if input_to_enhance is None:
|
| 101 |
input_to_enhance = generate(prompt, num_frames, image, model_name_stage1, model_name_stage2, seed, t, image_guidance)
|
| 102 |
encoded_video = video2video(prompt, input_to_enhance, result_fol, cfg_v2v, msxl_model)
|
|
|
|
| 182 |
with gr.Row():
|
| 183 |
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")
|
| 184 |
with gr.Row():
|
| 185 |
+
prompt_stage1 = gr.Textbox(label='Textual Prompt', placeholder=f"Ex: {default_prompt}")
|
| 186 |
with gr.Row():
|
| 187 |
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)
|
| 188 |
with gr.Column():
|