fcernafukuzaki commited on
Commit
60ff89a
·
verified ·
1 Parent(s): d41cd68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -51,17 +51,18 @@ def transcribe_2(audio_bytes):
51
  #audio = speech_v1.RecognitionAudio(content=audio_bytes)
52
  #request = speech_v1.RecognizeSpeechRequest(config=config, audio=audio)
53
  print(f"{type(audio_bytes)} {audio_bytes}")
54
- sr, y = audio_bytes
55
- print(f"{type(sr)} {sr}")
56
- print(type(y))
57
- y = y.astype(np.float32)
58
- y /= np.max(np.abs(y))
59
-
60
- import scipy.io.wavfile as wav
61
- RATE = sr
62
- numpydata = y
63
- file_name = 'out.wav'
64
- wav.write(file_name, RATE, numpydata)
 
65
  #the path of your audio file
66
  with io.open(file_name, "rb") as audio_file:
67
  content = audio_file.read()
 
51
  #audio = speech_v1.RecognitionAudio(content=audio_bytes)
52
  #request = speech_v1.RecognizeSpeechRequest(config=config, audio=audio)
53
  print(f"{type(audio_bytes)} {audio_bytes}")
54
+ file_name = audio_bytes
55
+ #sr, y = audio_bytes
56
+ #print(f"{type(sr)} {sr}")
57
+ #print(type(y))
58
+ #y = y.astype(np.float32)
59
+ #y /= np.max(np.abs(y))
60
+
61
+ #import scipy.io.wavfile as wav
62
+ #RATE = sr
63
+ #numpydata = y
64
+ #file_name = 'out.wav'
65
+ #wav.write(file_name, RATE, numpydata)
66
  #the path of your audio file
67
  with io.open(file_name, "rb") as audio_file:
68
  content = audio_file.read()