File size: 3,167 Bytes
06eca01
 
 
 
d5354f5
 
 
06eca01
5af8dc3
06eca01
 
 
 
 
016c990
d5354f5
d8834a7
06eca01
 
 
 
 
 
 
e08a3d7
 
0b808c1
 
d5354f5
04da7cb
 
d5354f5
 
 
0b808c1
 
 
 
 
21bdd6b
 
d5354f5
06eca01
97ed172
 
61e255a
97ed172
61e255a
97ed172
0b808c1
21bdd6b
 
d5354f5
06eca01
97ed172
 
 
016c990
 
e08a3d7
 
 
 
 
 
 
06eca01
 
 
 
 
5f40629
06eca01
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import gradio as gr
import vowel_length


meta_tsv = ['data/set1.tsv','data/set2.tsv']
ph_key = 'data/key_all.tsv'
align_output = 'data/aligns_csv.pickle'

dat,vck,kws,csvs = vowel_length.setup(meta_tsv,ph_key,align_output)

#    runan(w,'l1','w2v2',vck,dat,sources)
#    runan(w,'l1','mfa',vck,dat,sources)


def manager(word,group,aligner,side):
    fig = vowel_length.runan(word,group,aligner,vck,dat,csvs) #TODO add colour by plot-side
    print(side)
    return fig


bl = gr.Blocks()
with bl:


    #with gr.Tabs():
    #    with gr.TabItem("One"):
            gr.Markdown(
            """
            # Long and short Icelandic vowels 
            Choose a word, speaker group, and aligner type. Available speaker groups are native speakers, second-language speakers, or all. Aligner options are Montreal Forced Aligner (MFA) and CTC decoding with Wav2vec-2.0. 

    The general expectation is that syllables with long stressed vowels followed by short consonants have a higher vowel:consonant duration ratio, while syllables with short stressed vowels followed by long consonants have a lower vowel:consonant ratio. However, a great many other factors affect the relative duration in any one recorded token. See Pind 1999, 'Speech segment durations and quantity in Icelandic' (J. Acoustical Society of America, 106(2)) for a review of the acoustics of Icelandic vowel duration.

 All phoneme durations are measured automatically with no human correction. The purpose of this demo is to evaluate the role of such tools in large-scale phonetic research. Therefore, no measurements shown in this demo should be taken as conclusive without some independent verification. 
            """
                )

            with gr.Row():
                with gr.Column():
                    wmenu1 = gr.Dropdown(kws,label="Word",value="hala")
                    lmenu1 = gr.Dropdown(["L1", "L2","All"],label="Speaker group",value="L1")
                    amenu1 = gr.Dropdown(["MFA", "CTC"],label="Aligner",value="CTC")
    
                    btn1 = gr.Button(value="Update Plot 1")
                
                    pl1 = gr.Plot()
                    btn1.click(manager, [wmenu1, lmenu1, amenu1, btn1], pl1)
                                

                with gr.Column():
                    wmenu2 = gr.Dropdown(kws,label="Word",value="halla")
                    lmenu2 = gr.Dropdown(["L1", "L2","All"],label="Speaker group",value="L1")
                    amenu2 = gr.Dropdown(["MFA", "CTC"],label="Aligner",value="CTC")
    
                    btn2 = gr.Button(value="Update Plot 2")
                    pl2 = gr.Plot()
                    btn2.click(manager, [wmenu2, lmenu2, amenu2, btn2], pl2)

            
     #   with gr.TabItem("Two"):
     #       gr.Markdown(
     #       """
     #       # Forced alignment demo with CTC decoding
     #       Choose a language to record or upload a sentence with text. Generate word or letter time-alignments from the language's wav2vec-2.0 model, with output in MFA (Montreal Forced Aligner)-compatible format.
     #       """
           #      )




if __name__ == "__main__":
    bl.launch()