Miroga64 commited on
Commit ·
7992f77
1
Parent(s): 5da1916
Added logs
Browse files
main.py
CHANGED
|
@@ -5,9 +5,9 @@ from waitress import serve
|
|
| 5 |
import whisper
|
| 6 |
import librosa
|
| 7 |
import numpy as np
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
|
| 13 |
app = Flask(__name__)
|
|
@@ -22,9 +22,13 @@ class Main(Resource):
|
|
| 22 |
print(file)
|
| 23 |
|
| 24 |
audio, sr = librosa.load(file.stream)
|
|
|
|
| 25 |
audio_array = np.array(audio, dtype=np.float32)
|
|
|
|
| 26 |
model = whisper.load_model("large")
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
captions = [[(int)(caption["start"] * 1000), (int)(caption["end"] * 1000), caption["text"]] for caption in
|
| 29 |
result['segments']]
|
| 30 |
|
|
|
|
| 5 |
import whisper
|
| 6 |
import librosa
|
| 7 |
import numpy as np
|
| 8 |
+
import os
|
| 9 |
|
| 10 |
+
os.environ['TRANSFORMERS_CACHE'] = '/.cache/huggingface/hub'
|
| 11 |
|
| 12 |
|
| 13 |
app = Flask(__name__)
|
|
|
|
| 22 |
print(file)
|
| 23 |
|
| 24 |
audio, sr = librosa.load(file.stream)
|
| 25 |
+
print('NO ERROR 1')
|
| 26 |
audio_array = np.array(audio, dtype=np.float32)
|
| 27 |
+
print('NO ERROR 2')
|
| 28 |
model = whisper.load_model("large")
|
| 29 |
+
print('NO ERROR 3')
|
| 30 |
+
result = model.transcribe(audio_array, fp16=False)
|
| 31 |
+
print('NO ERROR 4')
|
| 32 |
captions = [[(int)(caption["start"] * 1000), (int)(caption["end"] * 1000), caption["text"]] for caption in
|
| 33 |
result['segments']]
|
| 34 |
|