cati commited on
Commit
90f256f
1 Parent(s): 69d94dc
Files changed (3) hide show
  1. .#ctcalign.py +1 -0
  2. app.py +8 -1
  3. ctcalign.py +12 -1
.#ctcalign.py ADDED
@@ -0,0 +1 @@
 
 
1
+ cati@kultanainen.local.57222
app.py CHANGED
@@ -61,10 +61,17 @@ All phoneme durations are measured automatically with no human correction. The p
61
  gr.Markdown(
62
  """
63
  # Forced alignment demo with CTC decoding
64
- 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.
65
  """
66
  )
67
 
 
 
 
 
 
 
 
68
 
69
 
70
 
 
61
  gr.Markdown(
62
  """
63
  # Forced alignment demo with CTC decoding
64
+ Choose a language to record or upload a sentence with corresponding text. Generate word and letter time-alignments from the language's wav2vec-2.0 model, with output in MFA (Montreal Forced Aligner)-compatible format.
65
  """
66
  )
67
 
68
+ audio_file = gr.Audio(type="filepath")
69
+ transcript_boxx = gr.Textbox(label="Transcript",placeholder="Type or paste the transcript here. Capitalisation and punctuation, if any, will be ignored.")
70
+ alangmenu = gr.Radio(["Icelandic", "Faroese", "Norwegian"],value="Icelandic")
71
+
72
+ al_btn = gr.Button(value="Run forced alignment")
73
+
74
+ output_box = gr.Textbox(label="Forced alignment output")
75
 
76
 
77
 
ctcalign.py CHANGED
@@ -11,7 +11,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
11
  torch.random.manual_seed(0)
12
 
13
  # info: https://huggingface.co/carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h/blob/main/vocab.json
14
- MODEL_PATH="/work/caitlinr/w2vrec/wav2vec2-large-xlsr-53-icelandic-ep10-1000h"
15
  model_blank_token = '[PAD]' # important to know for CTC decoding
16
  model_word_separator = '|'
17
  labels_dict = {"f": 0, "a": 1, "é": 2, "t": 3, "o": 4, "n": 5, "e": 6, "y": 8, "k": 9, "j": 10, "u": 11, "d": 12, "w": 13, "l": 14, "ú": 15, "q": 16, "g": 17, "í": 18, "s": 19, "r": 20, "ý": 21, "i": 22, "z": 23, "m": 24, "h": 25, "ó": 26, "þ": 27, "æ": 28, "c": 29, "á": 30, "v": 31, "b": 32, "ð": 33, "x": 34, "ö": 35, "p": 36, "|": 7, "[UNK]": 37, "[PAD]": 38}
@@ -25,6 +25,17 @@ blank_id = labels_dict[model_blank_token]
25
 
26
 
27
 
 
 
 
 
 
 
 
 
 
 
 
28
  #------------------------------------------
29
  # forced alignment with ctc decoder
30
  # originally based on implementation of
 
11
  torch.random.manual_seed(0)
12
 
13
  # info: https://huggingface.co/carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h/blob/main/vocab.json
14
+ MODEL_PATH="carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h"
15
  model_blank_token = '[PAD]' # important to know for CTC decoding
16
  model_word_separator = '|'
17
  labels_dict = {"f": 0, "a": 1, "é": 2, "t": 3, "o": 4, "n": 5, "e": 6, "y": 8, "k": 9, "j": 10, "u": 11, "d": 12, "w": 13, "l": 14, "ú": 15, "q": 16, "g": 17, "í": 18, "s": 19, "r": 20, "ý": 21, "i": 22, "z": 23, "m": 24, "h": 25, "ó": 26, "þ": 27, "æ": 28, "c": 29, "á": 30, "v": 31, "b": 32, "ð": 33, "x": 34, "ö": 35, "p": 36, "|": 7, "[UNK]": 37, "[PAD]": 38}
 
25
 
26
 
27
 
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
  #------------------------------------------
40
  # forced alignment with ctc decoder
41
  # originally based on implementation of