Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -621,9 +621,8 @@ def infer_example(image_path, audio_path, text, num_steps, raw_image_path, sessi
|
|
| 621 |
result = infer(image_path, audio_path, text, [[720, 400]], num_steps, session_id, progress)
|
| 622 |
|
| 623 |
return result
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
def infer(image_path, audio_path, text, orientation_state, num_steps, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
| 627 |
|
| 628 |
if image_path is None:
|
| 629 |
|
|
@@ -636,7 +635,17 @@ def infer(image_path, audio_path, text, orientation_state, num_steps, session_id
|
|
| 636 |
if session_id is None:
|
| 637 |
session_id = uuid.uuid4().hex
|
| 638 |
|
| 639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
output_dir = os.path.join(os.environ["PROCESSED_RESULTS"], session_id)
|
| 641 |
|
| 642 |
audio_dir = output_dir + '/audio'
|
|
@@ -946,7 +955,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 946 |
)
|
| 947 |
|
| 948 |
infer_btn.click(
|
| 949 |
-
fn=
|
| 950 |
inputs=[image_input, audio_input, text_input, orientation_state, num_steps, session_state],
|
| 951 |
outputs=[output_video]
|
| 952 |
)
|
|
|
|
| 621 |
result = infer(image_path, audio_path, text, [[720, 400]], num_steps, session_id, progress)
|
| 622 |
|
| 623 |
return result
|
| 624 |
+
|
| 625 |
+
def infer_scene(image_path, audio_path, text, orientation_state, num_steps, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
|
|
|
| 626 |
|
| 627 |
if image_path is None:
|
| 628 |
|
|
|
|
| 635 |
if session_id is None:
|
| 636 |
session_id = uuid.uuid4().hex
|
| 637 |
|
| 638 |
+
try:
|
| 639 |
+
result = infer(image_path, audio_path, text, orientation_state, num_steps, session_id, progress)
|
| 640 |
+
except Exception as e:
|
| 641 |
+
err = str(e).lower()
|
| 642 |
+
print(f"{session_id} failed due to {err}")
|
| 643 |
+
|
| 644 |
+
return result
|
| 645 |
+
|
| 646 |
+
@spaces.GPU(duration=get_duration)
|
| 647 |
+
def infer(image_path, audio_path, text, orientation_state, num_steps, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
| 648 |
+
|
| 649 |
output_dir = os.path.join(os.environ["PROCESSED_RESULTS"], session_id)
|
| 650 |
|
| 651 |
audio_dir = output_dir + '/audio'
|
|
|
|
| 955 |
)
|
| 956 |
|
| 957 |
infer_btn.click(
|
| 958 |
+
fn=infer_scene,
|
| 959 |
inputs=[image_input, audio_input, text_input, orientation_state, num_steps, session_state],
|
| 960 |
outputs=[output_video]
|
| 961 |
)
|