Update app.py
Browse files
app.py
CHANGED
|
@@ -78,9 +78,9 @@ def generate(
|
|
| 78 |
if is_tts:
|
| 79 |
# Extract the number after @tts
|
| 80 |
tts_part = message.strip().lower().split()[0] # Get the @ttsX part
|
| 81 |
-
if len(tts_part) >
|
| 82 |
try:
|
| 83 |
-
tts_index = int(tts_part[
|
| 84 |
if tts_index < 0 or tts_index >= len(voices):
|
| 85 |
gr.Warning(f"Invalid TTS voice index. Using default voice.")
|
| 86 |
tts_index = 0
|
|
|
|
| 78 |
if is_tts:
|
| 79 |
# Extract the number after @tts
|
| 80 |
tts_part = message.strip().lower().split()[0] # Get the @ttsX part
|
| 81 |
+
if len(tts_part) > 8: # Check if it's @ttsX (e.g., @tts1, @tts2, etc.)
|
| 82 |
try:
|
| 83 |
+
tts_index = int(tts_part[8:]) - 1 # Convert to 0-based index
|
| 84 |
if tts_index < 0 or tts_index >= len(voices):
|
| 85 |
gr.Warning(f"Invalid TTS voice index. Using default voice.")
|
| 86 |
tts_index = 0
|