Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
import gradio as gr
|
4 |
from extract_text_from_pdf import PDFTextExtractor
|
5 |
from generate_transcript import TranscriptProcessor
|
6 |
-
from generate_audio import TTSGenerator
|
|
|
7 |
import pickle
|
8 |
import os
|
9 |
import tempfile
|
@@ -64,9 +65,12 @@ def process_pdf_to_podcast(pdf_file):
|
|
64 |
|
65 |
|
66 |
# Final Step: Generate Audio after optional adjustments
|
67 |
-
|
68 |
def generate_audio_from_modified_text(tts_ready_text,session_dir):
|
69 |
-
|
|
|
|
|
|
|
70 |
tts_ready_path = os.path.join(session_dir, "podcast_ready_data.pkl")
|
71 |
audio_output_path = os.path.join(session_dir, "final_podcast_audio.mp3")
|
72 |
|
@@ -75,7 +79,8 @@ def generate_audio_from_modified_text(tts_ready_text,session_dir):
|
|
75 |
pickle.dump(tts_ready_text, f)
|
76 |
|
77 |
# Generate audio from the TTS-ready transcript
|
78 |
-
tts_gen = TTSGenerator(tts_ready_path,audio_output_path)
|
|
|
79 |
audio_path = tts_gen.generate_audio()
|
80 |
|
81 |
return f"Step 4 complete. Audio saved to {audio_path}.", audio_path
|
|
|
3 |
import gradio as gr
|
4 |
from extract_text_from_pdf import PDFTextExtractor
|
5 |
from generate_transcript import TranscriptProcessor
|
6 |
+
#from generate_audio import TTSGenerator
|
7 |
+
from generate_audio_edgetts import EdgeTTSGenerator
|
8 |
import pickle
|
9 |
import os
|
10 |
import tempfile
|
|
|
65 |
|
66 |
|
67 |
# Final Step: Generate Audio after optional adjustments
|
68 |
+
#@spaces.GPU(duration=300)
|
69 |
def generate_audio_from_modified_text(tts_ready_text,session_dir):
|
70 |
+
|
71 |
+
if not session_dir:
|
72 |
+
session_dir = create_temp_session_directory()
|
73 |
+
|
74 |
tts_ready_path = os.path.join(session_dir, "podcast_ready_data.pkl")
|
75 |
audio_output_path = os.path.join(session_dir, "final_podcast_audio.mp3")
|
76 |
|
|
|
79 |
pickle.dump(tts_ready_text, f)
|
80 |
|
81 |
# Generate audio from the TTS-ready transcript
|
82 |
+
#tts_gen = TTSGenerator(tts_ready_path,audio_output_path)
|
83 |
+
tts_gen = EdgeTTSGenerator(tts_ready_path,audio_output_path)
|
84 |
audio_path = tts_gen.generate_audio()
|
85 |
|
86 |
return f"Step 4 complete. Audio saved to {audio_path}.", audio_path
|