Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,18 +64,17 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
|
|
64 |
audio_path = f"audio_{job_id}.mp3"
|
65 |
intermediate_files.append(audio_path)
|
66 |
|
67 |
-
# !!!!!!!!!!! THIS IS THE FINAL, CORRECTED SECTION !!!!!!!!!!!
|
68 |
-
# The
|
69 |
-
|
70 |
text=narration,
|
71 |
voice="Adam",
|
72 |
model="eleven_multilingual_v2"
|
73 |
)
|
74 |
|
75 |
-
# Write the
|
76 |
with open(audio_path, "wb") as f:
|
77 |
-
|
78 |
-
f.write(chunk)
|
79 |
print(f"Audio file saved: {audio_path}")
|
80 |
# !!!!!!!!!!! END OF CORRECTED SECTION !!!!!!!!!!!
|
81 |
|
@@ -93,7 +92,7 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
|
|
93 |
raise gr.Error(f"Runway API did not return a task UUID. Response: {post_response.json()}")
|
94 |
|
95 |
video_url = None
|
96 |
-
for _ in range(60):
|
97 |
get_response = requests.get(f"{RUNWAY_API_URL}/{task_id}", headers=RUNWAY_HEADERS)
|
98 |
status_details = get_response.json()
|
99 |
status = status_details.get("status")
|
|
|
64 |
audio_path = f"audio_{job_id}.mp3"
|
65 |
intermediate_files.append(audio_path)
|
66 |
|
67 |
+
# !!!!!!!!!!! THIS IS THE FINAL, CORRECTED SECTION V3 !!!!!!!!!!!
|
68 |
+
# The function is client.generate() and it returns bytes directly.
|
69 |
+
audio_bytes = elevenlabs_client.generate(
|
70 |
text=narration,
|
71 |
voice="Adam",
|
72 |
model="eleven_multilingual_v2"
|
73 |
)
|
74 |
|
75 |
+
# Write the audio bytes to a file.
|
76 |
with open(audio_path, "wb") as f:
|
77 |
+
f.write(audio_bytes)
|
|
|
78 |
print(f"Audio file saved: {audio_path}")
|
79 |
# !!!!!!!!!!! END OF CORRECTED SECTION !!!!!!!!!!!
|
80 |
|
|
|
92 |
raise gr.Error(f"Runway API did not return a task UUID. Response: {post_response.json()}")
|
93 |
|
94 |
video_url = None
|
95 |
+
for _ in range(60):
|
96 |
get_response = requests.get(f"{RUNWAY_API_URL}/{task_id}", headers=RUNWAY_HEADERS)
|
97 |
status_details = get_response.json()
|
98 |
status = status_details.get("status")
|