Update app.py
Browse files
app.py
CHANGED
@@ -34,24 +34,34 @@ def setup():
|
|
34 |
#print('about to setup')
|
35 |
setup()
|
36 |
|
37 |
-
|
|
|
|
|
|
|
38 |
if langname=="Icelandic":
|
39 |
df = datas.ds_i
|
40 |
-
|
41 |
elif langname =="Faroese":
|
42 |
df = datas.ds_f
|
43 |
-
lang_aligner = datas.a_f
|
44 |
|
45 |
df = df.data.to_pandas()
|
46 |
df = df.drop(columns=['audio', 'speaker_id','duration'])
|
47 |
-
return (df[:15],
|
|
|
48 |
|
49 |
|
50 |
-
|
|
|
51 |
if langname=="Icelandic":
|
52 |
ds = datas.ds_i
|
|
|
53 |
elif langname =="Faroese":
|
54 |
ds = datas.ds_f
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
maxdat=len(ds)
|
57 |
|
@@ -65,6 +75,7 @@ def f1(langname,lang_aligner):
|
|
65 |
return (graph.align_and_graph(sound_path,transcript,lang_aligner),sound_path,rec_info)
|
66 |
|
67 |
|
|
|
68 |
bl = gr.Blocks()
|
69 |
|
70 |
with bl:
|
@@ -76,7 +87,7 @@ with bl:
|
|
76 |
### 3. Click the button below to view time-aligned prosody information for a random example
|
77 |
""" )
|
78 |
with gr.Row():
|
79 |
-
|
80 |
gr.Markdown(
|
81 |
"""
|
82 |
Pitch is shown in dark blue and loudness is the light orange line. The pitch estimation, and the time-alignment of words to audio, are completely automated and there will be some inaccuracy.
|
@@ -84,7 +95,13 @@ with bl:
|
|
84 |
""" )
|
85 |
|
86 |
align_func = gr.State()#value=ctcalign.aligner(model_path="carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h",model_word_separator = '|',model_blank_token = '[PAD]'))
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
with gr.Row():
|
89 |
#invisidata = gr.DataFrame(interactive=False, visible=False)
|
90 |
databrowser = gr.DataFrame(wrap=True, max_rows=50, interactive=False, overflow_row_behaviour='paginate')
|
@@ -102,12 +119,16 @@ with bl:
|
|
102 |
|
103 |
pl1 = gr.Plot()
|
104 |
|
105 |
-
btn1.click(f1, [lloadr,align_func], [pl1,audio1,ainfo])
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
|
113 |
gr.Markdown(
|
|
|
34 |
#print('about to setup')
|
35 |
setup()
|
36 |
|
37 |
+
# display some of the selected corpus
|
38 |
+
# (because gradio pagination is currently broken)
|
39 |
+
# and reset all filter menus
|
40 |
+
def pick_lang(langname):
|
41 |
if langname=="Icelandic":
|
42 |
df = datas.ds_i
|
43 |
+
|
44 |
elif langname =="Faroese":
|
45 |
df = datas.ds_f
|
|
|
46 |
|
47 |
df = df.data.to_pandas()
|
48 |
df = df.drop(columns=['audio', 'speaker_id','duration'])
|
49 |
+
return (df[:15],"all") #(df, df[:50])
|
50 |
+
|
51 |
|
52 |
|
53 |
+
|
54 |
+
def f1(langname,gender):
|
55 |
if langname=="Icelandic":
|
56 |
ds = datas.ds_i
|
57 |
+
lang_aligner = datas.a_i
|
58 |
elif langname =="Faroese":
|
59 |
ds = datas.ds_f
|
60 |
+
lang_aligner = datas.a_f
|
61 |
+
|
62 |
+
|
63 |
+
if gender != "all":
|
64 |
+
ds = ds.filter(lambda x: x["gender"].startswith(gender))
|
65 |
|
66 |
maxdat=len(ds)
|
67 |
|
|
|
75 |
return (graph.align_and_graph(sound_path,transcript,lang_aligner),sound_path,rec_info)
|
76 |
|
77 |
|
78 |
+
|
79 |
bl = gr.Blocks()
|
80 |
|
81 |
with bl:
|
|
|
87 |
### 3. Click the button below to view time-aligned prosody information for a random example
|
88 |
""" )
|
89 |
with gr.Row():
|
90 |
+
langmenu = gr.Dropdown(["Faroese", "Icelandic"], label="Language")#, info="Loading the dataset takes some time")
|
91 |
gr.Markdown(
|
92 |
"""
|
93 |
Pitch is shown in dark blue and loudness is the light orange line. The pitch estimation, and the time-alignment of words to audio, are completely automated and there will be some inaccuracy.
|
|
|
95 |
""" )
|
96 |
|
97 |
align_func = gr.State()#value=ctcalign.aligner(model_path="carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h",model_word_separator = '|',model_blank_token = '[PAD]'))
|
98 |
+
|
99 |
+
|
100 |
+
with gr.Row():
|
101 |
+
gmenu = gr.Dropdown(["all", "f", "m"], label="Gender", value="all")
|
102 |
+
amenu = gr.Dropdown(["all", 0, 1, 2, 3], label="Age", value="0")
|
103 |
+
|
104 |
+
|
105 |
with gr.Row():
|
106 |
#invisidata = gr.DataFrame(interactive=False, visible=False)
|
107 |
databrowser = gr.DataFrame(wrap=True, max_rows=50, interactive=False, overflow_row_behaviour='paginate')
|
|
|
119 |
|
120 |
pl1 = gr.Plot()
|
121 |
|
|
|
|
|
|
|
|
|
122 |
|
123 |
+
# when user selects a language,
|
124 |
+
# display some data
|
125 |
+
# and reset all filter menus
|
126 |
+
langmenu.change(pick_lang,langmenu,[databrowser,gmenu])
|
127 |
+
|
128 |
+
|
129 |
+
#
|
130 |
+
btn1.click(f1, [langmenu,gmenu], [pl1,audio1,ainfo])
|
131 |
+
|
132 |
|
133 |
|
134 |
gr.Markdown(
|