Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -68,14 +68,19 @@ def get_speakers_dict():
|
|
68 |
logger.error(f"Failed to import from new settings structure: {e}")
|
69 |
# Fallback to old structure if new one fails
|
70 |
try:
|
71 |
-
from maliba_ai.config.speakers import Adame, Moussa, Bourama, Modibo, Seydou
|
72 |
logger.info("Using fallback old speaker structure")
|
73 |
return {
|
74 |
"Adama": Adame,
|
75 |
"Moussa": Moussa,
|
76 |
"Bourama": Bourama,
|
77 |
"Modibo": Modibo,
|
78 |
-
"Seydou": Seydou
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
except Exception as e2:
|
81 |
logger.error(f"Failed to import speakers: {e2}")
|
@@ -104,7 +109,7 @@ def initialize_model_once():
|
|
104 |
start_time = time.time()
|
105 |
|
106 |
# Use the new import structure from the README
|
107 |
-
from maliba_ai.tts
|
108 |
|
109 |
model = BambaraTTSInference()
|
110 |
speakers = get_speakers_dict()
|
@@ -247,8 +252,8 @@ examples = [
|
|
247 |
["To tɔ nantan ni lafiya, o ka fisa ni so fa dumuniba kɛlɛma ye.", "Amadou"], # Warm and friendly voice for wisdom saying
|
248 |
["Mali ye jamana ɲuman ye!", "Bakary"], # Deep, authoritative tone for patriotic statement
|
249 |
["An ka ɲɔgɔn dɛmɛ ka baara kɛ ɲɔgɔn fɛ", "Ngolo"], # Youthful and energetic for collaboration
|
250 |
-
["Hakili
|
251 |
-
["
|
252 |
]
|
253 |
|
254 |
def get_safe_examples():
|
@@ -444,7 +449,8 @@ def build_interface():
|
|
444 |
def main():
|
445 |
"""Main function to launch the Gradio interface"""
|
446 |
logger.info("Starting Bambara TTS Gradio interface.")
|
447 |
-
|
|
|
448 |
interface = build_interface()
|
449 |
interface.launch(
|
450 |
server_name="0.0.0.0",
|
|
|
68 |
logger.error(f"Failed to import from new settings structure: {e}")
|
69 |
# Fallback to old structure if new one fails
|
70 |
try:
|
71 |
+
from maliba_ai.config.speakers import Adame, Moussa, Bourama, Modibo, Seydou, Amadou, Bakary, Ngolo, Ibrahima, Amara
|
72 |
logger.info("Using fallback old speaker structure")
|
73 |
return {
|
74 |
"Adama": Adame,
|
75 |
"Moussa": Moussa,
|
76 |
"Bourama": Bourama,
|
77 |
"Modibo": Modibo,
|
78 |
+
"Seydou": Seydou,
|
79 |
+
"Amadou": Amadou,
|
80 |
+
"Bakary": Bakary,
|
81 |
+
"Ngolo": Ngolo,
|
82 |
+
"Ibrahima": Ibrahima,
|
83 |
+
"Amara": Amara
|
84 |
}
|
85 |
except Exception as e2:
|
86 |
logger.error(f"Failed to import speakers: {e2}")
|
|
|
109 |
start_time = time.time()
|
110 |
|
111 |
# Use the new import structure from the README
|
112 |
+
from maliba_ai.tts import BambaraTTSInference
|
113 |
|
114 |
model = BambaraTTSInference()
|
115 |
speakers = get_speakers_dict()
|
|
|
252 |
["To tɔ nantan ni lafiya, o ka fisa ni so fa dumuniba kɛlɛma ye.", "Amadou"], # Warm and friendly voice for wisdom saying
|
253 |
["Mali ye jamana ɲuman ye!", "Bakary"], # Deep, authoritative tone for patriotic statement
|
254 |
["An ka ɲɔgɔn dɛmɛ ka baara kɛ ɲɔgɔn fɛ", "Ngolo"], # Youthful and energetic for collaboration
|
255 |
+
["Hakili to yɔrɔ min na, sabali bɛ yen", "Ibrahima"], # Calm and measured for philosophical thought
|
256 |
+
["Dɔnko ɲuman ye, a bɛ dɔn mɔgɔ kɔnɔ", "Amara"], # Melodic and smooth for poetic expression
|
257 |
]
|
258 |
|
259 |
def get_safe_examples():
|
|
|
449 |
def main():
|
450 |
"""Main function to launch the Gradio interface"""
|
451 |
logger.info("Starting Bambara TTS Gradio interface.")
|
452 |
+
|
453 |
+
# DO NOT preload - let it initialize on first request only (like your working version)
|
454 |
interface = build_interface()
|
455 |
interface.launch(
|
456 |
server_name="0.0.0.0",
|