Spaces:
Running
Running
mrfakename
commited on
Commit
•
9a35a6d
1
Parent(s):
cbc0056
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def gruut(text):
|
|
22 |
phonemized.append(word.phonemes)
|
23 |
phonemized_text = ' '.join(phonemized)
|
24 |
return phonemized_text
|
25 |
-
def
|
26 |
text = text.strip()
|
27 |
text = text.replace('"', '')
|
28 |
ps = global_phonemizer.phonemize([text])
|
@@ -31,7 +31,15 @@ def phonemizer(text):
|
|
31 |
return ps
|
32 |
def dp(text):
|
33 |
return phonemizer(text, lang='en_us')
|
34 |
-
|
|
|
|
|
|
|
35 |
with gr.Blocks() as demo:
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
demo.queue().launch()
|
|
|
22 |
phonemized.append(word.phonemes)
|
23 |
phonemized_text = ' '.join(phonemized)
|
24 |
return phonemized_text
|
25 |
+
def phonemizerfunc(text):
|
26 |
text = text.strip()
|
27 |
text = text.replace('"', '')
|
28 |
ps = global_phonemizer.phonemize([text])
|
|
|
31 |
return ps
|
32 |
def dp(text):
|
33 |
return phonemizer(text, lang='en_us')
|
34 |
+
def run(t, r):
|
35 |
+
if r == 'phonemizer': return phonemizerfunc(t)
|
36 |
+
if r == 'gruut': return gruut(t)
|
37 |
+
if r == 'deep_phonemizer': return dp(t)
|
38 |
with gr.Blocks() as demo:
|
39 |
+
gr.Markdown("# PhonemizerHub")
|
40 |
+
t = gr.Textbox(label="Text", placeholder="Enter text...", interactive=True)
|
41 |
+
r = gr.Radio(choices=['phonemizer', 'gruut', 'deep_phonemizer'], value='phonemizer', interactive=True, label='Select a phonemizer')
|
42 |
+
b = gr.Button("Phonemize")
|
43 |
+
out = gr.Textbox(interactive=True, label="Phonemes")
|
44 |
+
b.click(run, inputs=[t, r], outputs=[out])
|
45 |
demo.queue().launch()
|