Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -288,7 +288,7 @@ class PodcastGenerator:
|
|
288 |
Requirements:
|
289 |
- Exactly 2 speakers (speaker 1 and 2)
|
290 |
- Natural conversation style
|
291 |
-
- The podcast should be long
|
292 |
- Do not use names for the speakers.
|
293 |
- The Podcast starts with : welcome to our todays podcast !
|
294 |
- The podcast should be professional, in-depth, interesting, lively, witty and engaging, and hook the listener from the start.
|
@@ -429,7 +429,7 @@ Example JSON structure:
|
|
429 |
|
430 |
try:
|
431 |
combined_audio = AudioSegment.empty()
|
432 |
-
silence_padding = AudioSegment.silent(duration=
|
433 |
|
434 |
for i, audio_file in enumerate(audio_files):
|
435 |
try:
|
@@ -442,14 +442,14 @@ Example JSON structure:
|
|
442 |
file_size = os.path.getsize(audio_file)
|
443 |
add_log(f"📊 File size: {file_size} bytes")
|
444 |
|
445 |
-
if file_size <
|
446 |
-
add_log(f"⚠️ Audio file too small, skipping: {audio_file}")
|
447 |
continue
|
448 |
|
449 |
audio_segment = AudioSegment.from_file(audio_file)
|
450 |
|
451 |
-
if len(audio_segment) <
|
452 |
-
add_log(f"⚠️ Audio segment too short, skipping")
|
453 |
continue
|
454 |
|
455 |
combined_audio += audio_segment
|
@@ -476,7 +476,7 @@ Example JSON structure:
|
|
476 |
raise Exception("No valid audio content was generated")
|
477 |
|
478 |
if len(combined_audio) < 5000: # Less than 5 seconds
|
479 |
-
raise Exception("Combined audio is too short")
|
480 |
|
481 |
output_filename = f"podcast_output_{uuid.uuid4().hex[:8]}.wav"
|
482 |
combined_audio.export(output_filename, format="wav")
|
|
|
288 |
Requirements:
|
289 |
- Exactly 2 speakers (speaker 1 and 2)
|
290 |
- Natural conversation style
|
291 |
+
- The podcast should be long, at least 20 exchanges between the two speakers
|
292 |
- Do not use names for the speakers.
|
293 |
- The Podcast starts with : welcome to our todays podcast !
|
294 |
- The podcast should be professional, in-depth, interesting, lively, witty and engaging, and hook the listener from the start.
|
|
|
429 |
|
430 |
try:
|
431 |
combined_audio = AudioSegment.empty()
|
432 |
+
silence_padding = AudioSegment.silent(duration=800) # 800ms silence
|
433 |
|
434 |
for i, audio_file in enumerate(audio_files):
|
435 |
try:
|
|
|
442 |
file_size = os.path.getsize(audio_file)
|
443 |
add_log(f"📊 File size: {file_size} bytes")
|
444 |
|
445 |
+
if file_size < 2000:
|
446 |
+
add_log(f"⚠️ 1 Audio file too small, skipping: {audio_file}")
|
447 |
continue
|
448 |
|
449 |
audio_segment = AudioSegment.from_file(audio_file)
|
450 |
|
451 |
+
if len(audio_segment) < 500: # Less than 100ms
|
452 |
+
add_log(f"⚠️ 2 Audio segment too short, skipping")
|
453 |
continue
|
454 |
|
455 |
combined_audio += audio_segment
|
|
|
476 |
raise Exception("No valid audio content was generated")
|
477 |
|
478 |
if len(combined_audio) < 5000: # Less than 5 seconds
|
479 |
+
raise Exception("3 Combined audio is too short")
|
480 |
|
481 |
output_filename = f"podcast_output_{uuid.uuid4().hex[:8]}.wav"
|
482 |
combined_audio.export(output_filename, format="wav")
|