anyantudre commited on
Commit
c672237
·
verified ·
1 Parent(s): b708820

Update goai_stt.py

Browse files
Files changed (1) hide show
  1. goai_stt.py +5 -2
goai_stt.py CHANGED
@@ -1,5 +1,5 @@
1
- import librosa
2
  import torch
 
3
  import time
4
  from transformers import set_seed, Wav2Vec2ForCTC, AutoProcessor
5
 
@@ -20,6 +20,9 @@ def goai_stt(fichier):
20
  Le texte transcrit.
21
  """
22
 
 
 
 
23
  ### assurer reproducibilité
24
  set_seed(2024)
25
 
@@ -48,4 +51,4 @@ def goai_stt(fichier):
48
  transcription = processor.decode(pred_ids)
49
 
50
  print("Temps écoulé: ", int(time.time() - start_time), " secondes")
51
- return transcription
 
 
1
  import torch
2
+ import librosa
3
  import time
4
  from transformers import set_seed, Wav2Vec2ForCTC, AutoProcessor
5
 
 
20
  Le texte transcrit.
21
  """
22
 
23
+ if fichier is None:
24
+ raise ValueError("Le fichier audio est manquant.")
25
+
26
  ### assurer reproducibilité
27
  set_seed(2024)
28
 
 
51
  transcription = processor.decode(pred_ids)
52
 
53
  print("Temps écoulé: ", int(time.time() - start_time), " secondes")
54
+ return transcription