sulaimank commited on
Commit
5dab9a1
Β·
verified Β·
1 Parent(s): b99fafc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -61
app.py CHANGED
@@ -110,19 +110,6 @@ custom_css = """
110
  padding: 0 20px;
111
  }
112
 
113
- /* Model info styling */
114
- .model-info {
115
- font-size: 0.9em;
116
- color: #666;
117
- font-style: italic;
118
- margin-top: 5px;
119
- text-align: center;
120
- padding: 8px;
121
- background-color: #f8f9ff;
122
- border-radius: 8px;
123
- border: 1px solid #e1e5e9;
124
- }
125
-
126
  /* Status message styling */
127
  .status-message {
128
  padding: 12px;
@@ -208,37 +195,31 @@ with gr.Blocks(
208
 
209
  with gr.Row(equal_height=False):
210
  with gr.Column(scale=3, elem_classes=["input-section"]):
211
- # Center the text input
212
- with gr.Column():
213
- text_input = gr.Textbox(
214
- label=f"πŸ“ Enter Luganda Text (max {MAX_TXT_LEN} characters)",
215
- placeholder="Wandika wano ekigambo mu Luganda...",
216
- value="Gyebale ko ssebo.",
217
- lines=4,
218
- max_lines=6,
219
- )
220
 
221
- # Center the model selection
222
- with gr.Column():
223
- gr.Markdown(
224
- "<h3 style='text-align: center; margin: 20px 0 10px 0; color: #4c1d95;'>πŸŽ›οΈ Model Selection</h3>"
225
- )
226
- model_choice = gr.Radio(
227
- label="Choose TTS Model",
228
- choices=list(MODEL_INFO.keys()),
229
- value="Model 3",
230
- interactive=True,
231
- elem_classes=["radio-group"]
232
- )
233
 
234
- # Center the button
235
- with gr.Column():
236
- run_btn = gr.Button(
237
- "πŸ”Š Generate Speech",
238
- variant="primary",
239
- size="lg",
240
- elem_classes=["generate-btn"]
241
- )
242
 
243
  with gr.Column(scale=2, elem_classes=["audio-section"]):
244
  gr.Markdown(
@@ -258,11 +239,9 @@ with gr.Blocks(
258
  elem_classes=["status-message"]
259
  )
260
 
261
- # Examples section with better styling
262
  with gr.Column(elem_classes=["examples-section"]):
263
- gr.Markdown(
264
- "<div class='examples-title'>πŸ’‘ Try these Luganda examples:</div>"
265
- )
266
  gr.Examples(
267
  examples=examples,
268
  inputs=[text_input, model_choice],
@@ -272,16 +251,6 @@ with gr.Blocks(
272
  label=""
273
  )
274
 
275
- # Update model info when selection changes
276
- def update_model_info(choice):
277
- return f"**{MODEL_INFO[choice]['description']}**"
278
-
279
- model_choice.change(
280
- fn=update_model_info,
281
- inputs=[model_choice],
282
- outputs=[model_info]
283
- )
284
-
285
  # Connect the generate button
286
  run_btn.click(
287
  fn=tts,
@@ -289,8 +258,7 @@ with gr.Blocks(
289
  outputs=[audio_output, status_output]
290
  )
291
 
292
-
293
- # Footer with additional info
294
  gr.Markdown(
295
  """
296
  <div class="footer">
@@ -313,8 +281,8 @@ with gr.Blocks(
313
 
314
  if __name__ == "__main__":
315
  demo.launch(
316
- share=False, # Set to True if you want a public link
317
- server_name="0.0.0.0", # Allow external connections
318
  server_port=7860,
319
  show_error=True
320
- )
 
110
  padding: 0 20px;
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  /* Status message styling */
114
  .status-message {
115
  padding: 12px;
 
195
 
196
  with gr.Row(equal_height=False):
197
  with gr.Column(scale=3, elem_classes=["input-section"]):
198
+ text_input = gr.Textbox(
199
+ label=f"πŸ“ Enter Luganda Text (max {MAX_TXT_LEN} characters)",
200
+ placeholder="Wandika wano ekigambo mu Luganda...",
201
+ value="Gyebale ko ssebo.",
202
+ lines=4,
203
+ max_lines=6,
204
+ )
 
 
205
 
206
+ gr.Markdown(
207
+ "<h3 style='text-align: center; margin: 20px 0 10px 0; color: #4c1d95;'>πŸŽ›οΈ Model Selection</h3>"
208
+ )
209
+ model_choice = gr.Radio(
210
+ label="Choose TTS Model",
211
+ choices=list(MODEL_INFO.keys()),
212
+ value="Model 3",
213
+ interactive=True,
214
+ elem_classes=["radio-group"]
215
+ )
 
 
216
 
217
+ run_btn = gr.Button(
218
+ "πŸ”Š Generate Speech",
219
+ variant="primary",
220
+ size="lg",
221
+ elem_classes=["generate-btn"]
222
+ )
 
 
223
 
224
  with gr.Column(scale=2, elem_classes=["audio-section"]):
225
  gr.Markdown(
 
239
  elem_classes=["status-message"]
240
  )
241
 
242
+ # Examples section
243
  with gr.Column(elem_classes=["examples-section"]):
244
+ gr.Markdown("<div class='examples-title'>πŸ’‘ Try these Luganda examples:</div>")
 
 
245
  gr.Examples(
246
  examples=examples,
247
  inputs=[text_input, model_choice],
 
251
  label=""
252
  )
253
 
 
 
 
 
 
 
 
 
 
 
254
  # Connect the generate button
255
  run_btn.click(
256
  fn=tts,
 
258
  outputs=[audio_output, status_output]
259
  )
260
 
261
+ # Footer
 
262
  gr.Markdown(
263
  """
264
  <div class="footer">
 
281
 
282
  if __name__ == "__main__":
283
  demo.launch(
284
+ share=False,
285
+ server_name="0.0.0.0",
286
  server_port=7860,
287
  show_error=True
288
+ )