Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
| 41 |
-
|
| 42 |
#data,samplerate = librosa.load(output_file_path)
|
| 43 |
-
|
| 44 |
-
|
| 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(
|