clr commited on
Commit
277be2c
·
1 Parent(s): 08ac3bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -1,8 +1,7 @@
1
  import gradio as gr
2
  import subprocess,os
3
  from datasets import load_dataset, Audio
4
- import corpora
5
- import ctcalign,graph
6
  from numpy import random
7
 
8
 
@@ -37,26 +36,22 @@ setup()
37
 
38
  def load_lang(langname):
39
  if langname=="Icelandic":
40
- df = corpora.ds_i
41
- model_path="carlosdanielhernandezmena/wav2vec2-large-xlsr-53-icelandic-ep10-1000h"
42
  elif langname =="Faroese":
43
- df = corpora.ds_f
44
- model_path = "carlosdanielhernandezmena/wav2vec2-large-xlsr-53-faroese-100h"
45
-
46
- model_word_separator = '|'
47
- model_blank_token = '[PAD]'
48
- lang_aligner = ctcalign.aligner(model_path,model_word_separator,model_blank_token)
49
 
50
  df = df.data.to_pandas()
51
  df = df.drop(columns=['audio', 'speaker_id','duration'])
52
- return (df[:10], lang_aligner) #(df, df[:50])
53
 
54
 
55
  def f1(langname,lang_aligner):
56
  if langname=="Icelandic":
57
- ds = corpora.ds_i
58
  elif langname =="Faroese":
59
- ds = corpora.ds_f
60
 
61
 
62
  #fig = plt.figure(figsize=(10,4))
 
1
  import gradio as gr
2
  import subprocess,os
3
  from datasets import load_dataset, Audio
4
+ import datas,ctcalign,graph
 
5
  from numpy import random
6
 
7
 
 
36
 
37
  def load_lang(langname):
38
  if langname=="Icelandic":
39
+ df = datas.ds_i
40
+ lang_aligner = datas.a_i
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], lang_aligner) #(df, df[:50])
48
 
49
 
50
  def f1(langname,lang_aligner):
51
  if langname=="Icelandic":
52
+ ds = datas.ds_i
53
  elif langname =="Faroese":
54
+ ds = datas.ds_f
55
 
56
 
57
  #fig = plt.figure(figsize=(10,4))