Spaces:
Runtime error
Runtime error
save
Browse files
app.py
CHANGED
@@ -43,8 +43,8 @@ def runApi():
|
|
43 |
|
44 |
audio = "audio.mp3"
|
45 |
|
46 |
-
|
47 |
-
audio = whisper.pad_or_trim(
|
48 |
|
49 |
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
50 |
|
@@ -54,9 +54,9 @@ def runApi():
|
|
54 |
result = whisper.decode(model, mel, options)
|
55 |
|
56 |
# test 2
|
57 |
-
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
58 |
-
sample = ds[0]["audio"]
|
59 |
-
prediction = pipe(
|
60 |
print(prediction)
|
61 |
|
62 |
end_time = time.time()
|
|
|
43 |
|
44 |
audio = "audio.mp3"
|
45 |
|
46 |
+
audioOri = whisper.load_audio(audio)
|
47 |
+
audio = whisper.pad_or_trim(audioOri)
|
48 |
|
49 |
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
50 |
|
|
|
54 |
result = whisper.decode(model, mel, options)
|
55 |
|
56 |
# test 2
|
57 |
+
# ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
58 |
+
# sample = ds[0]["audio"]
|
59 |
+
prediction = pipe(audioOri)["text"]
|
60 |
print(prediction)
|
61 |
|
62 |
end_time = time.time()
|