Boadiwaa commited on
Commit
09df261
·
verified ·
1 Parent(s): cbe1194

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  import torch
5
  import numpy as np
6
  #import ast
7
- import librosa
8
  from transformers import (
9
  AutomaticSpeechRecognitionPipeline,
10
  WhisperForConditionalGeneration,
@@ -37,11 +37,11 @@ def transcribe(data):
37
  output_file_path = "audio.wav"
38
  with open(output_file_path, "wb") as output_file:
39
  output_file.write(decode_string)
40
- return "Success"
41
- #with torch.cuda.amp.autocast():
42
  #data,samplerate = librosa.load(output_file_path)
43
- #text = pipe(output_file_path,max_new_tokens=255)["text"]
44
- #return text
45
 
46
  #hf_writer = gr.HuggingFaceDatasetSaver(hf_token = api_key,dataset_name="interaction-log2")
47
  demo = gr.Interface(
 
4
  import torch
5
  import numpy as np
6
  #import ast
7
+ #import librosa
8
  from transformers import (
9
  AutomaticSpeechRecognitionPipeline,
10
  WhisperForConditionalGeneration,
 
37
  output_file_path = "audio.wav"
38
  with open(output_file_path, "wb") as output_file:
39
  output_file.write(decode_string)
40
+ print("Success")
41
+ with torch.cuda.amp.autocast():
42
  #data,samplerate = librosa.load(output_file_path)
43
+ text = pipe(output_file_path,max_new_tokens=255)["text"]
44
+ return text
45
 
46
  #hf_writer = gr.HuggingFaceDatasetSaver(hf_token = api_key,dataset_name="interaction-log2")
47
  demo = gr.Interface(