Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -197,7 +197,14 @@ def generate_scene(
|
|
| 197 |
if session_id is None:
|
| 198 |
session_id = uuid.uuid4().hex
|
| 199 |
|
| 200 |
-
print(f"generating scene with {sample_steps} steps")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
return generate_video(text_prompt,
|
| 203 |
sample_steps,
|
|
@@ -266,8 +273,6 @@ def generate_video(
|
|
| 266 |
if image is not None:
|
| 267 |
image_path = image
|
| 268 |
|
| 269 |
-
|
| 270 |
-
|
| 271 |
output_dir = os.path.join(os.environ["PROCESSED_RESULTS"], session_id)
|
| 272 |
os.makedirs(output_dir, exist_ok=True)
|
| 273 |
output_path = os.path.join(output_dir, f"generated_video.mp4")
|
|
@@ -295,6 +300,8 @@ def generate_video(
|
|
| 295 |
|
| 296 |
save_video(output_path, generated_video, generated_audio, fps=24, sample_rate=16000)
|
| 297 |
|
|
|
|
|
|
|
| 298 |
return output_path
|
| 299 |
|
| 300 |
|
|
@@ -450,4 +457,3 @@ if __name__ == "__main__":
|
|
| 450 |
demo.unload(cleanup)
|
| 451 |
demo.queue()
|
| 452 |
demo.launch(ssr_mode=False, share=True)
|
| 453 |
-
|
|
|
|
| 197 |
if session_id is None:
|
| 198 |
session_id = uuid.uuid4().hex
|
| 199 |
|
| 200 |
+
print(f"{session_id} is generating scene with {sample_steps} steps")
|
| 201 |
+
|
| 202 |
+
tags = ["<ENDAUDCAP>", "<AUDCAP>", "<E>", "<S>"]
|
| 203 |
+
|
| 204 |
+
found = [tag for tag in tags if tag in text_prompt]
|
| 205 |
+
|
| 206 |
+
if bool(found):
|
| 207 |
+
print(f"{session_id} used tages")
|
| 208 |
|
| 209 |
return generate_video(text_prompt,
|
| 210 |
sample_steps,
|
|
|
|
| 273 |
if image is not None:
|
| 274 |
image_path = image
|
| 275 |
|
|
|
|
|
|
|
| 276 |
output_dir = os.path.join(os.environ["PROCESSED_RESULTS"], session_id)
|
| 277 |
os.makedirs(output_dir, exist_ok=True)
|
| 278 |
output_path = os.path.join(output_dir, f"generated_video.mp4")
|
|
|
|
| 300 |
|
| 301 |
save_video(output_path, generated_video, generated_audio, fps=24, sample_rate=16000)
|
| 302 |
|
| 303 |
+
print(f"{session_id} video generation succeeded")
|
| 304 |
+
|
| 305 |
return output_path
|
| 306 |
|
| 307 |
|
|
|
|
| 457 |
demo.unload(cleanup)
|
| 458 |
demo.queue()
|
| 459 |
demo.launch(ssr_mode=False, share=True)
|
|
|