Spaces:
Running
Running
Update conver.py
Browse files
conver.py
CHANGED
@@ -166,22 +166,19 @@ class URLToAudioConverter:
|
|
166 |
return final_output, conversation_text
|
167 |
|
168 |
async def raw_text_to_audio(self, text: str, voice_1: str, voice_2: str) -> Tuple[str, str]:
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
183 |
return text, output_file
|
184 |
-
|
185 |
-
except Exception as e:
|
186 |
-
print(f"ERROR: {str(e)}")
|
187 |
-
return f"Error: {str(e)}", None
|
|
|
166 |
return final_output, conversation_text
|
167 |
|
168 |
async def raw_text_to_audio(self, text: str, voice_1: str, voice_2: str) -> Tuple[str, str]:
|
169 |
+
conversation = {
|
170 |
+
"conversation": [
|
171 |
+
{"speaker": "Host", "text": text},
|
172 |
+
{"speaker": "Co-host", "text": "(Continuación del tema)"}
|
173 |
+
]
|
174 |
+
}
|
175 |
+
audio_files, folder_name = await self.text_to_speech(conversation, voice_1, voice_2)
|
176 |
+
combined_audio = self.combine_audio_files(audio_files)
|
177 |
+
music_path = "assets/musica.mp3"
|
178 |
+
tags_paths = ["assets/tag.mp3", "assets/tag2.mp3"]
|
179 |
+
final_audio = self.add_background_music_and_tags(combined_audio, music_path, tags_paths)
|
180 |
+
output_file = os.path.join(folder_name, "raw_podcast_with_music.mp3")
|
181 |
+
final_audio.export(output_file, format="mp3")
|
182 |
+
for f in audio_files:
|
183 |
+
os.remove(f)
|
184 |
return text, output_file
|
|
|
|
|
|
|
|