Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -72,14 +72,18 @@ if start_eval:
|
|
72 |
st.write("Exemple brut :", example)
|
73 |
try:
|
74 |
#audio_path = example["file_name"] # full path or relative path in AudioFolder
|
75 |
-
audio_path = os.path.join(repo_local_path, example["file_name"])
|
76 |
reference = example["text"]
|
|
|
|
|
|
|
77 |
|
78 |
#st.write(example)
|
79 |
#st.write("Exemple brut :", dataset[0])
|
80 |
|
81 |
# Load audio (we assume dataset is structured with 'file_name')
|
82 |
-
waveform, _ = librosa.load(audio_path, sr=16000)
|
|
|
83 |
waveform = np.expand_dims(waveform, axis=0)
|
84 |
inputs = processor(waveform, sampling_rate=16000, return_tensors="pt")
|
85 |
|
@@ -104,7 +108,7 @@ if start_eval:
|
|
104 |
|
105 |
except Exception as e:
|
106 |
results.append({
|
107 |
-
"Fichier": example.get("
|
108 |
"Référence": "Erreur",
|
109 |
"Transcription": f"Erreur: {e}",
|
110 |
"WER": "-"
|
|
|
72 |
st.write("Exemple brut :", example)
|
73 |
try:
|
74 |
#audio_path = example["file_name"] # full path or relative path in AudioFolder
|
75 |
+
#audio_path = os.path.join(repo_local_path, example["file_name"])
|
76 |
reference = example["text"]
|
77 |
+
|
78 |
+
waveform = example["audio"]["array"]
|
79 |
+
audio_path = example["audio"]["path"]
|
80 |
|
81 |
#st.write(example)
|
82 |
#st.write("Exemple brut :", dataset[0])
|
83 |
|
84 |
# Load audio (we assume dataset is structured with 'file_name')
|
85 |
+
#waveform, _ = librosa.load(audio_path, sr=16000)
|
86 |
+
|
87 |
waveform = np.expand_dims(waveform, axis=0)
|
88 |
inputs = processor(waveform, sampling_rate=16000, return_tensors="pt")
|
89 |
|
|
|
108 |
|
109 |
except Exception as e:
|
110 |
results.append({
|
111 |
+
"Fichier": example["audio"].get("path", "unknown"),
|
112 |
"Référence": "Erreur",
|
113 |
"Transcription": f"Erreur: {e}",
|
114 |
"WER": "-"
|