camparchimedes commited on
Commit
2a7f812
·
verified ·
1 Parent(s): e79814a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -63,12 +63,8 @@ SIDEBAR_INFO = f"""
63
  </div>
64
  """
65
 
66
- # ------------transcribe section------------
67
- ) # chunk_length_s=30, generate_kwargs={'task': 'transcribe', 'language': 'no'}
68
-
69
  @spaces.GPU()
70
  def transcribe(microphone, file_upload):
71
- #--------------____________________________________________--------------"
72
  warn_output = ""
73
  if (microphone is not None) and (file_upload is not None):
74
  warn_output = (
@@ -80,17 +76,18 @@ def transcribe(microphone, file_upload):
80
  return "ERROR: You have to either use the microphone or upload an audio file"
81
 
82
  file = microphone if microphone is not None else file_upload
83
- #--------------____________________________________________--------------"
84
 
85
  start_time = time.time()
 
86
 
87
  #--------------____________________________________________--------------"
88
  device = "cuda" if torch.cuda.is_available() else "cpu"
89
  pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large", device=device)
90
-
91
  text = pipe(file)["text"]
92
  #--------------____________________________________________--------------"
93
 
 
94
  end_time = time.time()
95
  output_time = end_time - start_time
96
  word_count = len(text.split())
 
63
  </div>
64
  """
65
 
 
 
 
66
  @spaces.GPU()
67
  def transcribe(microphone, file_upload):
 
68
  warn_output = ""
69
  if (microphone is not None) and (file_upload is not None):
70
  warn_output = (
 
76
  return "ERROR: You have to either use the microphone or upload an audio file"
77
 
78
  file = microphone if microphone is not None else file_upload
 
79
 
80
  start_time = time.time()
81
+
82
 
83
  #--------------____________________________________________--------------"
84
  device = "cuda" if torch.cuda.is_available() else "cpu"
85
  pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large", device=device)
86
+ # chunk_length_s=30, generate_kwargs={'task': 'transcribe', 'language': 'no'}
87
  text = pipe(file)["text"]
88
  #--------------____________________________________________--------------"
89
 
90
+
91
  end_time = time.time()
92
  output_time = end_time - start_time
93
  word_count = len(text.split())