Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -31,26 +31,27 @@ _model_initialized = False
|
|
31 |
_initialization_in_progress = False
|
32 |
|
33 |
def get_speakers_dict():
|
34 |
-
"""Get speakers dictionary using the new SDK structure"""
|
35 |
try:
|
36 |
-
#
|
37 |
from maliba_ai.config.settings import Speakers
|
38 |
|
39 |
-
#
|
40 |
-
available_speakers = {
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
available_speakers[name] = getattr(Speakers, name)
|
48 |
-
|
49 |
-
if available_speakers:
|
50 |
-
logger.info(f"Loaded {len(available_speakers)} speakers from new structure: {list(available_speakers.keys())}")
|
51 |
-
return available_speakers
|
52 |
-
else:
|
53 |
-
raise AttributeError("No speakers found in new structure")
|
54 |
|
55 |
except Exception as e:
|
56 |
logger.error(f"Failed to import from new settings structure: {e}")
|
@@ -92,7 +93,7 @@ def initialize_model_once():
|
|
92 |
start_time = time.time()
|
93 |
|
94 |
# Use the new import structure from the README
|
95 |
-
from maliba_ai.tts import BambaraTTSInference
|
96 |
|
97 |
model = BambaraTTSInference()
|
98 |
speakers = get_speakers_dict()
|
@@ -321,7 +322,7 @@ def build_interface():
|
|
321 |
label="Generated Speech",
|
322 |
type="numpy",
|
323 |
interactive=False,
|
324 |
-
format="wav"
|
325 |
)
|
326 |
|
327 |
status_output = gr.Textbox(
|
|
|
31 |
_initialization_in_progress = False
|
32 |
|
33 |
def get_speakers_dict():
|
34 |
+
"""Get speakers dictionary using the correct new SDK structure"""
|
35 |
try:
|
36 |
+
# Use the correct new structure as shown in your example
|
37 |
from maliba_ai.config.settings import Speakers
|
38 |
|
39 |
+
# Create dictionary with all 10 speakers using proper syntax
|
40 |
+
available_speakers = {
|
41 |
+
"Bourama": Speakers.Bourama,
|
42 |
+
"Adama": Speakers.Adama,
|
43 |
+
"Moussa": Speakers.Moussa,
|
44 |
+
"Modibo": Speakers.Modibo,
|
45 |
+
"Seydou": Speakers.Seydou,
|
46 |
+
"Amadou": Speakers.Amadou,
|
47 |
+
"Bakary": Speakers.Bakary,
|
48 |
+
"Ngolo": Speakers.Ngolo,
|
49 |
+
"Ibrahima": Speakers.Ibrahima,
|
50 |
+
"Amara": Speakers.Amara
|
51 |
+
}
|
52 |
|
53 |
+
logger.info(f"Loaded {len(available_speakers)} speakers from new structure: {list(available_speakers.keys())}")
|
54 |
+
return available_speakers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
except Exception as e:
|
57 |
logger.error(f"Failed to import from new settings structure: {e}")
|
|
|
93 |
start_time = time.time()
|
94 |
|
95 |
# Use the new import structure from the README
|
96 |
+
from maliba_ai.tts.inference import BambaraTTSInference
|
97 |
|
98 |
model = BambaraTTSInference()
|
99 |
speakers = get_speakers_dict()
|
|
|
322 |
label="Generated Speech",
|
323 |
type="numpy",
|
324 |
interactive=False,
|
325 |
+
format="wav" # Specify WAV format to help with conversion
|
326 |
)
|
327 |
|
328 |
status_output = gr.Textbox(
|