Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -616,7 +616,7 @@ def preprocess_img(input_image_path, raw_image_path, orientation_state, session_
|
|
| 616 |
|
| 617 |
return input_img_path, raw_image_path
|
| 618 |
|
| 619 |
-
def infer_example(image_path, audio_path, text,
|
| 620 |
|
| 621 |
if session_id is None:
|
| 622 |
session_id = uuid.uuid4().hex
|
|
@@ -624,7 +624,7 @@ def infer_example(image_path, audio_path, text, num_steps, raw_image_path, sessi
|
|
| 624 |
limited_audio_path = preprocess_audio_first_5s_librosa(audio_path, True, session_id)
|
| 625 |
|
| 626 |
image_path, _ = preprocess_img(image_path, image_path, [[720, 400]], session_id)
|
| 627 |
-
result = infer(image_path, limited_audio_path, text, [[720, 400]],
|
| 628 |
|
| 629 |
return result
|
| 630 |
|
|
@@ -885,7 +885,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 885 |
"examples/images/female-001.png",
|
| 886 |
"examples/audios/script.wav",
|
| 887 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
| 888 |
-
8,
|
| 889 |
''
|
| 890 |
],
|
| 891 |
|
|
@@ -894,7 +893,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 894 |
"examples/images/male-001.png",
|
| 895 |
"examples/audios/denial.wav",
|
| 896 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
| 897 |
-
8,
|
| 898 |
''
|
| 899 |
],
|
| 900 |
|
|
@@ -902,7 +900,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 902 |
"examples/images/female-003.png",
|
| 903 |
"examples/audios/matcha.wav",
|
| 904 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
| 905 |
-
8,
|
| 906 |
''
|
| 907 |
],
|
| 908 |
|
|
@@ -910,13 +907,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 910 |
"examples/images/female-007.png",
|
| 911 |
"examples/audios/listen.wav",
|
| 912 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
| 913 |
-
8,
|
| 914 |
''
|
| 915 |
],
|
| 916 |
|
| 917 |
],
|
| 918 |
label="Cached Examples",
|
| 919 |
-
inputs=[image_input, audio_input, text_input,
|
| 920 |
outputs=[output_video],
|
| 921 |
fn=infer_example,
|
| 922 |
cache_examples=True
|
|
|
|
| 616 |
|
| 617 |
return input_img_path, raw_image_path
|
| 618 |
|
| 619 |
+
def infer_example(image_path, audio_path, text, raw_image_path, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
| 620 |
|
| 621 |
if session_id is None:
|
| 622 |
session_id = uuid.uuid4().hex
|
|
|
|
| 624 |
limited_audio_path = preprocess_audio_first_5s_librosa(audio_path, True, session_id)
|
| 625 |
|
| 626 |
image_path, _ = preprocess_img(image_path, image_path, [[720, 400]], session_id)
|
| 627 |
+
result = infer(image_path, limited_audio_path, text, [[720, 400]], 8, session_id, progress)
|
| 628 |
|
| 629 |
return result
|
| 630 |
|
|
|
|
| 885 |
"examples/images/female-001.png",
|
| 886 |
"examples/audios/script.wav",
|
| 887 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
|
|
|
| 888 |
''
|
| 889 |
],
|
| 890 |
|
|
|
|
| 893 |
"examples/images/male-001.png",
|
| 894 |
"examples/audios/denial.wav",
|
| 895 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
|
|
|
| 896 |
''
|
| 897 |
],
|
| 898 |
|
|
|
|
| 900 |
"examples/images/female-003.png",
|
| 901 |
"examples/audios/matcha.wav",
|
| 902 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
|
|
|
| 903 |
''
|
| 904 |
],
|
| 905 |
|
|
|
|
| 907 |
"examples/images/female-007.png",
|
| 908 |
"examples/audios/listen.wav",
|
| 909 |
ADAPTIVE_PROMPT_TEMPLATES[1],
|
|
|
|
| 910 |
''
|
| 911 |
],
|
| 912 |
|
| 913 |
],
|
| 914 |
label="Cached Examples",
|
| 915 |
+
inputs=[image_input, audio_input, text_input, raw_img_text],
|
| 916 |
outputs=[output_video],
|
| 917 |
fn=infer_example,
|
| 918 |
cache_examples=True
|