Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -207,13 +207,20 @@ class PodcastGenerator:
|
|
207 |
]
|
208 |
}
|
209 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
system_prompt = f"""
|
211 |
-
You are a professional podcast generator. Your task is to generate a professional podcast script based on the user input.
|
212 |
-
|
213 |
- The podcast should have 2 speakers.
|
214 |
- The podcast should be long.
|
215 |
- The speakers must not mention each other by name.
|
216 |
-
- The podcast should be interesting and engaging, and hook the listener from the start.
|
|
|
217 |
- The script must be in JSON format.
|
218 |
Follow this example structure:
|
219 |
{example}
|
@@ -299,7 +306,7 @@ async def process_input(input_text: str, input_file, language: str, speaker1: st
|
|
299 |
"Remy - French (France)": "fr-FR-RemyMultilingualNeural",
|
300 |
"Vivienne - French (France)": "fr-FR-VivienneMultilingualNeural"
|
301 |
}
|
302 |
-
|
303 |
speaker1 = voice_names[speaker1]
|
304 |
speaker2 = voice_names[speaker2]
|
305 |
|
@@ -316,6 +323,7 @@ iface = gr.Interface(
|
|
316 |
gr.Textbox(label="Input Text"),
|
317 |
gr.File(label="Or Upload a PDF or TXT file"),
|
318 |
gr.Dropdown(label="Language", choices=[
|
|
|
319 |
"Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani",
|
320 |
"Bahasa Indonesian", "Bangla", "Basque", "Bengali", "Bosnian", "Bulgarian",
|
321 |
"Burmese", "Catalan", "Chinese Cantonese", "Chinese Mandarin",
|
@@ -330,7 +338,7 @@ iface = gr.Interface(
|
|
330 |
"Swedish", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu",
|
331 |
"Uzbek", "Vietnamese", "Welsh", "Zulu"
|
332 |
],
|
333 |
-
value="
|
334 |
gr.Dropdown(label="Speaker 1 Voice", choices=[
|
335 |
"Andrew - English (United States)",
|
336 |
"Ava - English (United States)",
|
|
|
207 |
]
|
208 |
}
|
209 |
"""
|
210 |
+
|
211 |
+
if language == "Auto Detect":
|
212 |
+
language_instruction = "- The podcast MUST be in the same language as the user input."
|
213 |
+
else:
|
214 |
+
language_instruction = f"- The podcast MUST be in {language} language"
|
215 |
+
|
216 |
system_prompt = f"""
|
217 |
+
You are a professional podcast generator. Your task is to generate a professional podcast script based on the user input.
|
218 |
+
{language_instruction}
|
219 |
- The podcast should have 2 speakers.
|
220 |
- The podcast should be long.
|
221 |
- The speakers must not mention each other by name.
|
222 |
+
- The podcast should be interesting, lively, and engaging, and hook the listener from the start.
|
223 |
+
- The input text might be disorganized or unformatted, originating from sources like PDFs or text files. Ignore any formatting inconsistencies or irrelevant details; your task is to distill the essential points, identify key definitions, and highlight intriguing facts that would be suitable for discussion in a podcast.
|
224 |
- The script must be in JSON format.
|
225 |
Follow this example structure:
|
226 |
{example}
|
|
|
306 |
"Remy - French (France)": "fr-FR-RemyMultilingualNeural",
|
307 |
"Vivienne - French (France)": "fr-FR-VivienneMultilingualNeural"
|
308 |
}
|
309 |
+
|
310 |
speaker1 = voice_names[speaker1]
|
311 |
speaker2 = voice_names[speaker2]
|
312 |
|
|
|
323 |
gr.Textbox(label="Input Text"),
|
324 |
gr.File(label="Or Upload a PDF or TXT file"),
|
325 |
gr.Dropdown(label="Language", choices=[
|
326 |
+
"Auto Detect",
|
327 |
"Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani",
|
328 |
"Bahasa Indonesian", "Bangla", "Basque", "Bengali", "Bosnian", "Bulgarian",
|
329 |
"Burmese", "Catalan", "Chinese Cantonese", "Chinese Mandarin",
|
|
|
338 |
"Swedish", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu",
|
339 |
"Uzbek", "Vietnamese", "Welsh", "Zulu"
|
340 |
],
|
341 |
+
value="Auto Detect"),
|
342 |
gr.Dropdown(label="Speaker 1 Voice", choices=[
|
343 |
"Andrew - English (United States)",
|
344 |
"Ava - English (United States)",
|