Spaces:
Running
on
T4
Running
on
T4
gabrielchua
commited on
Commit
•
112bea7
1
Parent(s):
8ddd281
fix SUNO prompt
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ from pydub import AudioSegment
|
|
19 |
|
20 |
# Local imports
|
21 |
from prompts import SYSTEM_PROMPT
|
22 |
-
from utils import generate_script,
|
23 |
|
24 |
LANGUAGE_MAPPING = {
|
25 |
"English": "en",
|
@@ -153,7 +153,7 @@ def generate_podcast(
|
|
153 |
total_characters += len(line.text)
|
154 |
|
155 |
# Get audio file path
|
156 |
-
audio_file_path =
|
157 |
line.text, line.speaker, LANGUAGE_MAPPING[language]
|
158 |
)
|
159 |
# Read the audio file into an AudioSegment
|
@@ -243,22 +243,22 @@ demo = gr.Interface(
|
|
243 |
"Short (1-2 min)",
|
244 |
"English",
|
245 |
],
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
],
|
263 |
cache_examples=True,
|
264 |
)
|
|
|
19 |
|
20 |
# Local imports
|
21 |
from prompts import SYSTEM_PROMPT
|
22 |
+
from utils import generate_script, generate_podcast_audio, parse_url
|
23 |
|
24 |
LANGUAGE_MAPPING = {
|
25 |
"English": "en",
|
|
|
153 |
total_characters += len(line.text)
|
154 |
|
155 |
# Get audio file path
|
156 |
+
audio_file_path = generate_podcast_audio(
|
157 |
line.text, line.speaker, LANGUAGE_MAPPING[language]
|
158 |
)
|
159 |
# Read the audio file into an AudioSegment
|
|
|
243 |
"Short (1-2 min)",
|
244 |
"English",
|
245 |
],
|
246 |
+
# [
|
247 |
+
# [],
|
248 |
+
# "https://en.wikipedia.org/wiki/Hugging_Face",
|
249 |
+
# "How did Hugging Face become so successful?",
|
250 |
+
# "Fun",
|
251 |
+
# "Short (1-2 min)",
|
252 |
+
# "English",
|
253 |
+
# ],
|
254 |
+
# [
|
255 |
+
# [],
|
256 |
+
# "https://simple.wikipedia.org/wiki/Taylor_Swift",
|
257 |
+
# "Why is Taylor Swift so popular?",
|
258 |
+
# "Fun",
|
259 |
+
# "Short (1-2 min)",
|
260 |
+
# "English",
|
261 |
+
# ],
|
262 |
],
|
263 |
cache_examples=True,
|
264 |
)
|
utils.py
CHANGED
@@ -78,7 +78,7 @@ def parse_url(url: str) -> str:
|
|
78 |
return response.text
|
79 |
|
80 |
|
81 |
-
def
|
82 |
|
83 |
audio_array = generate_audio(text, history_prompt=f"v2/{language}_speaker_{'1' if speaker == 'Host (Jane)' else '3'}")
|
84 |
|
|
|
78 |
return response.text
|
79 |
|
80 |
|
81 |
+
def generate_podcast_audio(text: str, speaker: str, language: str) -> str:
|
82 |
|
83 |
audio_array = generate_audio(text, history_prompt=f"v2/{language}_speaker_{'1' if speaker == 'Host (Jane)' else '3'}")
|
84 |
|