fcernafukuzaki commited on
Commit
3a921e4
·
verified ·
1 Parent(s): 72805bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -15,18 +15,19 @@ rutas = [os.getcwd(),"deploygpt-e9475e7c2c7c.json"]
15
  print('/'.join(rutas))
16
  os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = '/'.join(rutas)
17
 
18
- #transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base.en")
19
-
20
- #def transcribe(audio_bytes):
21
- # """Transcribe audio bytes to text using Google Cloud Speech to Text."""
22
- #
23
- # sr, y = audio_bytes
24
- # y = y.astype(np.float32)
25
- # y /= np.max(np.abs(y))
26
- #
27
- # return transcriber({"sampling_rate": sr, "raw": y})["text"]
28
 
29
  def transcribe(audio_bytes):
 
 
 
 
 
 
 
 
 
 
30
  """Transcribe audio bytes to text using Google Cloud Speech to Text."""
31
 
32
  # Crea un cliente de Speech to Text
 
15
  print('/'.join(rutas))
16
  os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = '/'.join(rutas)
17
 
18
+ transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base.en")
 
 
 
 
 
 
 
 
 
19
 
20
  def transcribe(audio_bytes):
21
+ print(type(audio_bytes))
22
+ """Transcribe audio bytes to text using Google Cloud Speech to Text."""
23
+
24
+ sr, y = audio_bytes
25
+ y = y.astype(np.float32)
26
+ y /= np.max(np.abs(y))
27
+
28
+ return transcriber({"sampling_rate": sr, "raw": y})["text"]
29
+
30
+ def transcribe_2(audio_bytes):
31
  """Transcribe audio bytes to text using Google Cloud Speech to Text."""
32
 
33
  # Crea un cliente de Speech to Text