Dionyssos commited on
Commit
d316893
·
1 Parent(s): a383337

buttons css

Browse files
Files changed (1) hide show
  1. app.py +39 -36
app.py CHANGED
@@ -479,51 +479,54 @@ description = (
479
  "recognises the expression dimensions arousal, dominance, and valence. "
480
  )
481
 
482
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  with gr.Tab(label="other TTS"):
484
-
485
- selected_voice = gr.State(value='wav/en_US_m-ailabs_mary_ann.wav')
486
-
487
- with gr.Row():
488
- voice_info = gr.Markdown(f'TTS vox : `{selected_voice.value}`')
489
-
490
- # Main input and output components
491
  with gr.Row():
492
- text_input = gr.Textbox(
493
- label="Enter text for TTS:",
494
- placeholder="Type your message here...",
495
- lines=4,
496
- value="Farover the misty mountains cold too dungeons deep and caverns old.",
497
- )
498
- generate_button = gr.Button("Generate Audio", variant="primary")
499
-
500
  output_audio = gr.Audio(label="TTS Output")
501
-
502
  with gr.Column():
503
  voice_buttons = []
504
  for i in range(0, len(VOICES), 7):
505
- with gr.Row():
506
  for voice_filename in VOICES[i:i+7]:
507
  voice_filename = voice_filename[4:-4] # drop wav/ for visibility
508
- button = gr.Button(voice_filename)
509
-
510
- button.click(
511
- fn=update_selected_voice,
512
- inputs=[gr.Textbox(value=voice_filename, visible=False)],
513
- outputs=[selected_voice]
514
- )
515
- button.click(
516
- fn=lambda v=voice_filename: f"TTS Vox = `{v}`",
517
- inputs=None,
518
- outputs=voice_info
519
- )
520
  voice_buttons.append(button)
521
-
522
- generate_button.click(
523
- fn=other_tts,
524
- inputs=[text_input, selected_voice],
525
- outputs=output_audio
526
- )
527
 
528
  with gr.Tab(label="Speech Analysis"):
529
  with gr.Row():
 
479
  "recognises the expression dimensions arousal, dominance, and valence. "
480
  )
481
 
482
+ css_buttons = """
483
+ .cool-button {
484
+ background-color: #1a2a40; /* Slightly lighter dark blue */
485
+ color: white;
486
+ padding: 15px 32px;
487
+ text-align: center;
488
+ font-size: 16px;
489
+ border-radius: 12px;
490
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
491
+ transition: all 0.3s ease-in-out;
492
+ border: none;
493
+ cursor: pointer;
494
+ }
495
+ .cool-button:hover {
496
+ background-color: #1a2a40; /* Slightly lighter dark blue */
497
+ transform: scale(1.05);
498
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
499
+ }
500
+ .cool-row {
501
+ margin-bottom: 10px;
502
+ }
503
+ """
504
+
505
+ with gr.Blocks(theme='huggingface', css=css_buttons) as demo:
506
  with gr.Tab(label="other TTS"):
507
+ selected_voice = gr.State(value='en_US_m-ailabs_mary_ann.wav')
 
 
 
 
 
 
508
  with gr.Row():
509
+ text_input = gr.Textbox(label=f"Text for TTS: Voice={selected_voice.value}",
510
+ placeholder="Type your message here...",
511
+ lines=4,
512
+ value="Farover the misty mountains cold too dungeons deep and caverns old.")
513
+ generate_button = gr.Button("Generate Audio",
514
+ variant="primary")
 
 
515
  output_audio = gr.Audio(label="TTS Output")
 
516
  with gr.Column():
517
  voice_buttons = []
518
  for i in range(0, len(VOICES), 7):
519
+ with gr.Row(elem_classes=["cool-row"]):
520
  for voice_filename in VOICES[i:i+7]:
521
  voice_filename = voice_filename[4:-4] # drop wav/ for visibility
522
+ button = gr.Button(voice_filename, elem_classes=["cool-button"])
523
+ button.click(fn=update_selected_voice,
524
+ inputs=[gr.Textbox(value=voice_filename, visible=False)],
525
+ outputs=[selected_voice, text_input])
 
 
 
 
 
 
 
 
526
  voice_buttons.append(button)
527
+ generate_button.click(fn=other_tts,
528
+ inputs=[text_input, selected_voice],
529
+ outputs=output_audio)
 
 
 
530
 
531
  with gr.Tab(label="Speech Analysis"):
532
  with gr.Row():