Spaces:
Sleeping
Sleeping
song
Browse files
rag.py
CHANGED
|
@@ -213,4 +213,4 @@ def retrieve_context(vectorstore, query: str, k: int = 8, mode: str = None) -> s
|
|
| 213 |
)
|
| 214 |
|
| 215 |
context = "\n\n---\n\n".join([r.page_content for r in all_results])
|
| 216 |
-
return context
|
|
|
|
| 213 |
)
|
| 214 |
|
| 215 |
context = "\n\n---\n\n".join([r.page_content for r in all_results])
|
| 216 |
+
return context
|
tts.py
CHANGED
|
@@ -38,6 +38,9 @@ VOICE_MAP = {
|
|
| 38 |
|
| 39 |
# Lecture professor
|
| 40 |
"PROFESSOR": ("en-GB-RyanNeural", "-5%", "-3Hz"), # British Male, measured/academic
|
|
|
|
|
|
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
DEFAULT_VOICE = ("en-US-EmmaMultilingualNeural", "-5%", "+0Hz")
|
|
@@ -74,7 +77,7 @@ def parse_script(script: str) -> list:
|
|
| 74 |
|
| 75 |
if not cleaned:
|
| 76 |
print("[VoiceVerse TTS] Warning: No speaker labels found. Using NARRATOR fallback.")
|
| 77 |
-
full_text = re.sub(r"^[A-Z]+:\s*", "", script, flags=re.MULTILINE)
|
| 78 |
full_text = " ".join(full_text.strip().split())
|
| 79 |
if full_text:
|
| 80 |
cleaned = [("NARRATOR", full_text)]
|
|
@@ -192,4 +195,4 @@ def script_to_audio(script: str, output_path: str) -> str:
|
|
| 192 |
except Exception:
|
| 193 |
pass
|
| 194 |
|
| 195 |
-
return output_path
|
|
|
|
| 38 |
|
| 39 |
# Lecture professor
|
| 40 |
"PROFESSOR": ("en-GB-RyanNeural", "-5%", "-3Hz"), # British Male, measured/academic
|
| 41 |
+
|
| 42 |
+
# Poem — warm, measured narration (same as storytelling but slightly slower)
|
| 43 |
+
# NARRATOR voice is already defined above and is reused for poem mode
|
| 44 |
}
|
| 45 |
|
| 46 |
DEFAULT_VOICE = ("en-US-EmmaMultilingualNeural", "-5%", "+0Hz")
|
|
|
|
| 77 |
|
| 78 |
if not cleaned:
|
| 79 |
print("[VoiceVerse TTS] Warning: No speaker labels found. Using NARRATOR fallback.")
|
| 80 |
+
full_text = re.sub(r"^[A-Z]+:\s*", "", script, flags=re.MULTILINE) # strip any label
|
| 81 |
full_text = " ".join(full_text.strip().split())
|
| 82 |
if full_text:
|
| 83 |
cleaned = [("NARRATOR", full_text)]
|
|
|
|
| 195 |
except Exception:
|
| 196 |
pass
|
| 197 |
|
| 198 |
+
return output_path
|