sudoping01 commited on
Commit
6469f27
·
verified ·
1 Parent(s): c42740b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -38,14 +38,12 @@ def initialize_model():
38
  logger.info("Initializing Bambara TTS model...")
39
 
40
  try:
41
- # Import inside GPU context to avoid CUDA initialization errors
42
  from maliba_ai.tts.inference import BambaraTTSInference
43
  from maliba_ai.config.speakers import Adame, Moussa, Bourama, Modibo, Seydou
44
 
45
- # Initialize model
46
  tts_model = BambaraTTSInference()
47
 
48
- # Initialize speakers
49
  speakers_dict = {
50
  "Adame": Adame,
51
  "Moussa": Moussa,
@@ -64,7 +62,6 @@ def initialize_model():
64
  return tts_model, speakers_dict
65
 
66
  def validate_inputs(text, temperature, top_k, top_p, max_tokens):
67
- """Validate user inputs"""
68
  if not text or not text.strip():
69
  return False, "Please enter some Bambara text."
70
 
@@ -126,28 +123,33 @@ SPEAKER_NAMES = ["Adame", "Moussa", "Bourama", "Modibo", "Seydou"]
126
 
127
  examples = [
128
  ["Aw ni ce", "Adame"],
129
- ["I ni ce", "Moussa"],
130
- ["Aw ni tile", "Bourama"],
131
- ["I ka kene wa?", "Modibo"],
132
- ["Lakɔli karamɔgɔw tun tɛ ka se ka sɛbɛnni kɛ ka ɲɛ walanba kan wa denmisɛnw tun tɛ se ka o sɛbɛnni ninnu ye kuma tɛ ka kalan. Denmisɛnw kɛra kunfinw ye", "Adame"],
133
  ["sigikafɔ kɔnɔ jamanaw ni ɲɔgɔn cɛ, olu ye a haminankow ye, wa o ko ninnu ka kan ka kɛ sariya ani tilennenya kɔnɔ", "Seydou"],
134
- ["Aw ni ce. Ne tɔgɔ ye Adama. Awɔ ne ye Malien de ye. Aw Sanbɛ, Sanbɛ. San min tɛ ɲinan ye, an bɛɛ ka jɛ ka o seli ɲɔgɔn fɛ, hɛɛrɛ ni lafiya la. Ala ka Mali suma. Ala ka Mali yiriwa. Ala ka Mali taa ɲɛ. Ala ka an ka seliw caya. Ala ka yafa an bɛɛ ma", "Moussa"],
135
  ["An dɔlakelen bɛ masike bilenman don ka tɔw gɛn.", "Bourama"],
136
  ["Aw ni ce. Seidu bɛ aw fo wa aw ka yafa a ma, ka da a kan tuma dɔw la kow ka can.", "Modibo"],
 
137
  ]
138
 
139
  def build_interface():
140
  """Build the Gradio interface for Bambara TTS"""
141
 
142
- with gr.Blocks(title="Bambara TTS - EXPERIMENTAL", theme=gr.themes.Soft()) as demo:
143
  gr.Markdown("""
144
  # 🎤 Bambara Text-to-Speech ⚠️ EXPERIMENTAL
145
 
146
- Convert Bambara text to speech using AI. This model is currently experimental.
 
 
147
 
148
  **Bambara** is spoken by millions of people in Mali and West Africa.
149
  .
150
  """)
 
 
151
 
152
  with gr.Row():
153
  with gr.Column(scale=2):
@@ -155,8 +157,8 @@ def build_interface():
155
  label="📝 Bambara Text",
156
  placeholder="Type your Bambara text here...",
157
  lines=3,
158
- max_lines=6,
159
- value="Aw ni ce"
160
  )
161
 
162
  speaker_dropdown = gr.Dropdown(
@@ -241,7 +243,6 @@ def build_interface():
241
  with gr.Accordion(" About", open=False):
242
  gr.Markdown("""
243
  **⚠️ This is an experimental Bambara TTS model.**
244
-
245
  - **Languages**: Bambara (bm)
246
  - **Speakers**: 5 different voice options
247
  - **Sample Rate**: 16kHz
 
38
  logger.info("Initializing Bambara TTS model...")
39
 
40
  try:
 
41
  from maliba_ai.tts.inference import BambaraTTSInference
42
  from maliba_ai.config.speakers import Adame, Moussa, Bourama, Modibo, Seydou
43
 
44
+
45
  tts_model = BambaraTTSInference()
46
 
 
47
  speakers_dict = {
48
  "Adame": Adame,
49
  "Moussa": Moussa,
 
62
  return tts_model, speakers_dict
63
 
64
  def validate_inputs(text, temperature, top_k, top_p, max_tokens):
 
65
  if not text or not text.strip():
66
  return False, "Please enter some Bambara text."
67
 
 
123
 
124
  examples = [
125
  ["Aw ni ce", "Adame"],
126
+ ["Mali bɛna diya kɔsɛbɛ, ka a da a kan baara bɛ ka kɛ.", "Moussa"],
127
+ ["Ne se ka sɛbɛnni yɛlɛma ka kɛ kuma ye", "Bourama"],
128
+ ["I ka kɛnɛ wa?", "Modibo"],
129
+ ["Lakɔli karamɔgɔw tun tɛ ka se ka sɛbɛnni kɛ ka ɲɛ walanba kan wa denmisɛnw tun tɛ ka se ka o sɛbɛnni ninnu ye, kuma tɛ ka u kalan. Denmisɛnw kɛra kunfinw ye", "Adame"],
130
  ["sigikafɔ kɔnɔ jamanaw ni ɲɔgɔn cɛ, olu ye a haminankow ye, wa o ko ninnu ka kan ka kɛ sariya ani tilennenya kɔnɔ", "Seydou"],
131
+ ["Aw ni ce. Ne tɔgɔ ye Adama. Awɔ ne ye Maliden de ye. Aw Sanbe Sanbe. San min tɛ ɲinan ye, an bɛɛ ka jɛ ka o seli ɲɔgɔn fɛ, hɛɛrɛ ni lafiya la. Ala ka Mali suma. Ala ka Mali yiriwa. Ala ka Mali taa ɲɛ. Ala ka an ka seliw caya. Ala ka yafa an bɛɛ ma", "Moussa"],
132
  ["An dɔlakelen bɛ masike bilenman don ka tɔw gɛn.", "Bourama"],
133
  ["Aw ni ce. Seidu bɛ aw fo wa aw ka yafa a ma, ka da a kan tuma dɔw la kow ka can.", "Modibo"],
134
+
135
  ]
136
 
137
  def build_interface():
138
  """Build the Gradio interface for Bambara TTS"""
139
 
140
+ with gr.Blocks(title="Bambara TTS - EXPERIMENTAL") as demo:
141
  gr.Markdown("""
142
  # 🎤 Bambara Text-to-Speech ⚠️ EXPERIMENTAL
143
 
144
+ **Powered by MALIBA-AI**
145
+
146
+ Convert Bambara text to speech. This model is currently experimental.
147
 
148
  **Bambara** is spoken by millions of people in Mali and West Africa.
149
  .
150
  """)
151
+
152
+
153
 
154
  with gr.Row():
155
  with gr.Column(scale=2):
 
157
  label="📝 Bambara Text",
158
  placeholder="Type your Bambara text here...",
159
  lines=3,
160
+ max_lines=10,
161
+ value="I ni ce"
162
  )
163
 
164
  speaker_dropdown = gr.Dropdown(
 
243
  with gr.Accordion(" About", open=False):
244
  gr.Markdown("""
245
  **⚠️ This is an experimental Bambara TTS model.**
 
246
  - **Languages**: Bambara (bm)
247
  - **Speakers**: 5 different voice options
248
  - **Sample Rate**: 16kHz