Shubham09 commited on
Commit
4dd7c15
·
1 Parent(s): 3e99ba1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -25,10 +25,12 @@ def load_data(input_file):
25
  speech = librosa.resample(speech, sample_rate,16000)
26
  return speech
27
  def write_to_file(input_file):
28
- import base64
29
- wav_file = open("temp.wav", "wb")
30
- decode_string = base64.b64decode(input_file)
31
- wav_file.write(decode_string)
 
 
32
 
33
  # def correct_casing(input_sentence):
34
 
@@ -36,8 +38,8 @@ def write_to_file(input_file):
36
  # return (' '.join([s.replace(s[0],s[0].capitalize(),1) for s in sentences]))
37
  pipe = pipeline(model="Shubham09/whisper31filescheck") # change to "your-username/the-name-you-picked"
38
 
39
- def asr_transcript(input_file="temp.wav"):
40
- text = pipe(input_file)["text"]
41
  return text
42
 
43
  # speech = load_data(input_file)
 
25
  speech = librosa.resample(speech, sample_rate,16000)
26
  return speech
27
  def write_to_file(input_file):
28
+ with open("microphone-results.wav", "wb") as f:
29
+ f.write(input_file.get_wav_data())
30
+ # import base64
31
+ # wav_file = open("temp.wav", "wb")
32
+ # decode_string = base64.b64decode(input_file)
33
+ # wav_file.write(decode_string)
34
 
35
  # def correct_casing(input_sentence):
36
 
 
38
  # return (' '.join([s.replace(s[0],s[0].capitalize(),1) for s in sentences]))
39
  pipe = pipeline(model="Shubham09/whisper31filescheck") # change to "your-username/the-name-you-picked"
40
 
41
+ def asr_transcript(input_file="microphone-results.wav"):
42
+ text = pipe("microphone-results.wav")["text"]
43
  return text
44
 
45
  # speech = load_data(input_file)