jonathanagustin commited on
Commit
0dbb78f
1 Parent(s): ce4caa3

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +31 -33
app.py CHANGED
@@ -86,6 +86,37 @@ def main():
86
 
87
  with gr.Blocks(title="OpenAI - Text to Speech") as demo:
88
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  with gr.Column(scale=1):
90
  api_key_input = gr.Textbox(
91
  label="OpenAI API Key",
@@ -104,39 +135,6 @@ def main():
104
  value="echo",
105
  )
106
 
107
- # Replace the Accordion with a Group for Voice Previews
108
- with gr.Group():
109
- gr.Markdown("### Voice Previews")
110
-
111
- # Create an audio component to play the samples
112
- preview_audio = gr.Audio(
113
- interactive=False,
114
- label="Preview Audio",
115
- value=None,
116
- visible=True,
117
- autoplay=True,
118
- )
119
-
120
- # A function to update the preview_audio component
121
- def play_voice_sample(voice):
122
- return gr.update(value=VOICE_PREVIEW_FILES[voice])
123
-
124
- # Create buttons for each voice inside a grid
125
- with gr.Grid():
126
- for voice in VOICE_OPTIONS:
127
- # Create a button for each voice
128
- voice_button = gr.Button(
129
- value=f"{voice.capitalize()}",
130
- variant="secondary",
131
- size="sm",
132
- )
133
-
134
- # Attach the click handler
135
- voice_button.click(
136
- fn=lambda v=voice: play_voice_sample(v),
137
- outputs=preview_audio,
138
- )
139
-
140
  with gr.Column(scale=2):
141
  input_textbox = gr.Textbox(
142
  label="Input Text",
 
86
 
87
  with gr.Blocks(title="OpenAI - Text to Speech") as demo:
88
  with gr.Row():
89
+ with gr.Column(scale=1):
90
+ gr.Markdown("### Voice Previews")
91
+
92
+ # A function to update the preview_audio component
93
+ def play_voice_sample(voice):
94
+ return gr.update(value=VOICE_PREVIEW_FILES[voice])
95
+
96
+ # Create buttons for each voice inside a grid
97
+ for voice in VOICE_OPTIONS:
98
+ # Create a button for each voice
99
+ voice_button = gr.Button(
100
+ value=f"{voice.capitalize()}",
101
+ variant="secondary",
102
+ size="sm",
103
+ )
104
+
105
+ # Attach the click handler
106
+ voice_button.click(
107
+ fn=lambda v=voice: play_voice_sample(v),
108
+ outputs=preview_audio,
109
+ )
110
+
111
+ # Create an audio component to play the samples
112
+ preview_audio = gr.Audio(
113
+ interactive=False,
114
+ label="Preview Audio",
115
+ value=None,
116
+ visible=True,
117
+ autoplay=True,
118
+ )
119
+
120
  with gr.Column(scale=1):
121
  api_key_input = gr.Textbox(
122
  label="OpenAI API Key",
 
135
  value="echo",
136
  )
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  with gr.Column(scale=2):
139
  input_textbox = gr.Textbox(
140
  label="Input Text",