fosters commited on
Commit
9ce1e22
·
verified ·
1 Parent(s): da75d4b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -92,7 +92,7 @@ def phonemize_batch(texts):
92
  if isinstance(texts, str):
93
  # Split by newlines if input is a single string
94
  text_list = [line.strip()
95
- for line in texts.split('\n') if line.strip()]
96
  else:
97
  text_list = [str(text).strip() for text in texts if str(text).strip()]
98
 
@@ -150,7 +150,7 @@ with gr.Blocks(
150
  }
151
  """
152
  ) as demo:
153
- gr.HTML("""
154
  <div class="title">🗣️ Belarusian Phonemizer</div>
155
  <div class="description">
156
  Convert Belarusian text to International Phonetic Alphabet (IPA) notation
@@ -168,13 +168,13 @@ with gr.Blocks(
168
  max_lines=10,
169
  info="Type or paste Belarusian text that you want to convert to phonemes"
170
  )
171
-
172
  phonemize_btn = gr.Button(
173
  "Convert to Phonemes",
174
  variant="primary",
175
  size="lg"
176
  )
177
-
178
  with gr.Column():
179
  output_text = gr.Textbox(
180
  label="IPA Phonemes",
@@ -183,7 +183,7 @@ with gr.Blocks(
183
  interactive=False,
184
  info="The phonemic transcription in IPA notation will appear here"
185
  )
186
-
187
  # Examples section
188
  gr.Examples(
189
  examples=[
@@ -199,20 +199,20 @@ with gr.Blocks(
199
  cache_examples=False,
200
  label="Example Texts"
201
  )
202
-
203
  # Event handlers for single text
204
  phonemize_btn.click(
205
  fn=phonemize_text,
206
  inputs=input_text,
207
  outputs=output_text
208
  )
209
-
210
  input_text.submit(
211
  fn=phonemize_text,
212
  inputs=input_text,
213
  outputs=output_text
214
  )
215
-
216
  with gr.TabItem("Batch Processing"):
217
  with gr.Row():
218
  with gr.Column():
@@ -223,13 +223,13 @@ with gr.Blocks(
223
  max_lines=20,
224
  info="Enter multiple texts, one per line. Each line will be processed separately."
225
  )
226
-
227
  batch_btn = gr.Button(
228
  "Convert Batch to Phonemes",
229
  variant="primary",
230
  size="lg"
231
  )
232
-
233
  with gr.Column():
234
  batch_output = gr.Textbox(
235
  label="Batch IPA Results",
@@ -238,7 +238,7 @@ with gr.Blocks(
238
  interactive=False,
239
  info="Results will appear here, one per line matching your input"
240
  )
241
-
242
  # Batch examples
243
  gr.Examples(
244
  examples=[
@@ -251,14 +251,14 @@ with gr.Blocks(
251
  cache_examples=False,
252
  label="Batch Examples"
253
  )
254
-
255
  # Event handlers for batch
256
  batch_btn.click(
257
  fn=lambda x: '\n'.join(phonemize_batch(x)),
258
  inputs=batch_input,
259
  outputs=batch_output
260
  )
261
-
262
  batch_input.submit(
263
  fn=lambda x: '\n'.join(phonemize_batch(x)),
264
  inputs=batch_input,
 
92
  if isinstance(texts, str):
93
  # Split by newlines if input is a single string
94
  text_list = [line.strip()
95
+ for line in texts.split('\n') if line.strip()]
96
  else:
97
  text_list = [str(text).strip() for text in texts if str(text).strip()]
98
 
 
150
  }
151
  """
152
  ) as demo:
153
+ gr.HTML("""
154
  <div class="title">🗣️ Belarusian Phonemizer</div>
155
  <div class="description">
156
  Convert Belarusian text to International Phonetic Alphabet (IPA) notation
 
168
  max_lines=10,
169
  info="Type or paste Belarusian text that you want to convert to phonemes"
170
  )
171
+
172
  phonemize_btn = gr.Button(
173
  "Convert to Phonemes",
174
  variant="primary",
175
  size="lg"
176
  )
177
+
178
  with gr.Column():
179
  output_text = gr.Textbox(
180
  label="IPA Phonemes",
 
183
  interactive=False,
184
  info="The phonemic transcription in IPA notation will appear here"
185
  )
186
+
187
  # Examples section
188
  gr.Examples(
189
  examples=[
 
199
  cache_examples=False,
200
  label="Example Texts"
201
  )
202
+
203
  # Event handlers for single text
204
  phonemize_btn.click(
205
  fn=phonemize_text,
206
  inputs=input_text,
207
  outputs=output_text
208
  )
209
+
210
  input_text.submit(
211
  fn=phonemize_text,
212
  inputs=input_text,
213
  outputs=output_text
214
  )
215
+
216
  with gr.TabItem("Batch Processing"):
217
  with gr.Row():
218
  with gr.Column():
 
223
  max_lines=20,
224
  info="Enter multiple texts, one per line. Each line will be processed separately."
225
  )
226
+
227
  batch_btn = gr.Button(
228
  "Convert Batch to Phonemes",
229
  variant="primary",
230
  size="lg"
231
  )
232
+
233
  with gr.Column():
234
  batch_output = gr.Textbox(
235
  label="Batch IPA Results",
 
238
  interactive=False,
239
  info="Results will appear here, one per line matching your input"
240
  )
241
+
242
  # Batch examples
243
  gr.Examples(
244
  examples=[
 
251
  cache_examples=False,
252
  label="Batch Examples"
253
  )
254
+
255
  # Event handlers for batch
256
  batch_btn.click(
257
  fn=lambda x: '\n'.join(phonemize_batch(x)),
258
  inputs=batch_input,
259
  outputs=batch_output
260
  )
261
+
262
  batch_input.submit(
263
  fn=lambda x: '\n'.join(phonemize_batch(x)),
264
  inputs=batch_input,