Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -545,12 +545,20 @@ async def run_tts_pipeline(task_id: str, story: StoryCreationDTO):
|
|
| 545 |
file_name = f"{uuid.uuid4()}_{os.path.basename(final_generated_story_path)}"
|
| 546 |
storage_path = f"{story.storyId}/final/{file_name}"
|
| 547 |
|
| 548 |
-
with open(final_generated_story_path, "rb") as f:
|
| 549 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
|
| 551 |
supabase.storage.from_("story-audio-files").upload(
|
| 552 |
storage_path,
|
| 553 |
-
|
| 554 |
)
|
| 555 |
|
| 556 |
# 6️⃣ Get public URL
|
|
|
|
| 545 |
file_name = f"{uuid.uuid4()}_{os.path.basename(final_generated_story_path)}"
|
| 546 |
storage_path = f"{story.storyId}/final/{file_name}"
|
| 547 |
|
| 548 |
+
# with open(final_generated_story_path, "rb") as f:
|
| 549 |
+
# file_bytes = f.read()
|
| 550 |
+
|
| 551 |
+
print(f" final_generated_story_path: {final_generated_story_path}")
|
| 552 |
+
|
| 553 |
+
wav = AudioSegment.from_wav(final_generated_story_path)
|
| 554 |
+
mp3_path = final_generated_story_path.replace(".wav", ".mp3")
|
| 555 |
+
wav.export(mp3_path, format="mp3", bitrate="192k")
|
| 556 |
+
|
| 557 |
+
print(f" final_generated_story_path after conversion to mp3: {mp3_path}")
|
| 558 |
|
| 559 |
supabase.storage.from_("story-audio-files").upload(
|
| 560 |
storage_path,
|
| 561 |
+
mp3_path
|
| 562 |
)
|
| 563 |
|
| 564 |
# 6️⃣ Get public URL
|