Spaces:
Running
on
Zero
Running
on
Zero
alex
commited on
Commit
·
6e127d9
1
Parent(s):
7cf279d
example test
Browse files
app.py
CHANGED
|
@@ -114,7 +114,7 @@ def restore_inductor_cache_from_hub(repo_id: str, filename: str = "torch_compile
|
|
| 114 |
# restore_inductor_cache_from_hub("alexnasa/humo-compiled")
|
| 115 |
|
| 116 |
|
| 117 |
-
def get_duration(prompt_text, steps, image_file, audio_file_path, tea_cache_l1_thresh, max_duration, session_id):
|
| 118 |
|
| 119 |
return calculate_required_time(steps, max_duration)
|
| 120 |
|
|
@@ -148,7 +148,7 @@ def update_required_time(steps, max_duration):
|
|
| 148 |
return get_required_time_string(steps, max_duration)
|
| 149 |
|
| 150 |
|
| 151 |
-
def generate_scene(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh, max_duration = 2, session_id = None):
|
| 152 |
|
| 153 |
print(image_paths)
|
| 154 |
prompt_text_check = (prompt_text or "").strip()
|
|
@@ -158,9 +158,12 @@ def generate_scene(prompt_text, steps, image_paths, audio_file_path, tea_cache_l
|
|
| 158 |
if not audio_file_path and not image_paths:
|
| 159 |
raise gr.Error("Please provide a reference image or a lipsync audio.")
|
| 160 |
|
| 161 |
-
return run_pipeline(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh, max_duration, session_id)
|
| 162 |
|
| 163 |
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
def upload_inductor_cache_to_hub(
|
| 166 |
repo_id: str,
|
|
@@ -214,7 +217,7 @@ def upload_inductor_cache_to_hub(
|
|
| 214 |
|
| 215 |
|
| 216 |
@spaces.GPU(duration=get_duration)
|
| 217 |
-
def run_pipeline(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh = 0.0, max_duration = 2, session_id = None):
|
| 218 |
|
| 219 |
if session_id is None:
|
| 220 |
session_id = uuid.uuid4().hex
|
|
@@ -416,7 +419,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 416 |
],
|
| 417 |
inputs=[prompt_tb, steps_input, img_input, audio_input],
|
| 418 |
outputs=[video_output],
|
| 419 |
-
fn=
|
| 420 |
cache_examples=True,
|
| 421 |
)
|
| 422 |
max_duration.change(update_required_time, [steps_input, max_duration], time_required)
|
|
|
|
| 114 |
# restore_inductor_cache_from_hub("alexnasa/humo-compiled")
|
| 115 |
|
| 116 |
|
| 117 |
+
def get_duration(prompt_text, steps, image_file, audio_file_path, tea_cache_l1_thresh, max_duration, session_id, progress):
|
| 118 |
|
| 119 |
return calculate_required_time(steps, max_duration)
|
| 120 |
|
|
|
|
| 148 |
return get_required_time_string(steps, max_duration)
|
| 149 |
|
| 150 |
|
| 151 |
+
def generate_scene(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh, max_duration = 2, session_id = None, progress=gr.Progress(track_tqdm=True)):
|
| 152 |
|
| 153 |
print(image_paths)
|
| 154 |
prompt_text_check = (prompt_text or "").strip()
|
|
|
|
| 158 |
if not audio_file_path and not image_paths:
|
| 159 |
raise gr.Error("Please provide a reference image or a lipsync audio.")
|
| 160 |
|
| 161 |
+
return run_pipeline(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh, max_duration, session_id, progress)
|
| 162 |
|
| 163 |
|
| 164 |
+
def generate_example(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh = 0.0, max_duration = 5, session_id = None, progress=gr.Progress(track_tqdm=True)):
|
| 165 |
+
|
| 166 |
+
return run_pipeline(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh, max_duration, session_id, progress)
|
| 167 |
|
| 168 |
def upload_inductor_cache_to_hub(
|
| 169 |
repo_id: str,
|
|
|
|
| 217 |
|
| 218 |
|
| 219 |
@spaces.GPU(duration=get_duration)
|
| 220 |
+
def run_pipeline(prompt_text, steps, image_paths, audio_file_path, tea_cache_l1_thresh = 0.0, max_duration = 2, session_id = None, progress=gr.Progress(track_tqdm=True)):
|
| 221 |
|
| 222 |
if session_id is None:
|
| 223 |
session_id = uuid.uuid4().hex
|
|
|
|
| 419 |
],
|
| 420 |
inputs=[prompt_tb, steps_input, img_input, audio_input],
|
| 421 |
outputs=[video_output],
|
| 422 |
+
fn=generate_example,
|
| 423 |
cache_examples=True,
|
| 424 |
)
|
| 425 |
max_duration.change(update_required_time, [steps_input, max_duration], time_required)
|