Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import subprocess,os
|
|
| 3 |
from datasets import load_dataset, Audio
|
| 4 |
import corpora
|
| 5 |
import ctcalign,graph
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
import matplotlib
|
|
@@ -53,9 +54,9 @@ def load_lang(langname):
|
|
| 53 |
|
| 54 |
def f1(langname,lang_aligner):
|
| 55 |
if langname=="Icelandic":
|
| 56 |
-
|
| 57 |
elif langname =="Faroese":
|
| 58 |
-
|
| 59 |
|
| 60 |
|
| 61 |
#fig = plt.figure(figsize=(10,4))
|
|
@@ -63,9 +64,12 @@ def f1(langname,lang_aligner):
|
|
| 63 |
#plt.xlabel("Vowel length (ms)")
|
| 64 |
#plt.ylabel("Consonant length (ms)")
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
| 67 |
#print([th for th in ds.sample()])
|
| 68 |
-
sound_path = ds['audio']['path']
|
| 69 |
transcript = ds['normalized_text']
|
| 70 |
|
| 71 |
return graph.align_and_graph(sound_path,transcript,lang_aligner)
|
|
|
|
| 3 |
from datasets import load_dataset, Audio
|
| 4 |
import corpora
|
| 5 |
import ctcalign,graph
|
| 6 |
+
from numpy import random
|
| 7 |
|
| 8 |
|
| 9 |
import matplotlib
|
|
|
|
| 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))
|
|
|
|
| 64 |
#plt.xlabel("Vowel length (ms)")
|
| 65 |
#plt.ylabel("Consonant length (ms)")
|
| 66 |
|
| 67 |
+
|
| 68 |
+
maxdat=len(df)
|
| 69 |
+
|
| 70 |
+
ds = ds.select([random.randint(maxdat-1)])
|
| 71 |
#print([th for th in ds.sample()])
|
| 72 |
+
sound_path = ds['audio'][0]['path'] # audio 0 array is the audio data itself
|
| 73 |
transcript = ds['normalized_text']
|
| 74 |
|
| 75 |
return graph.align_and_graph(sound_path,transcript,lang_aligner)
|