minor bug
Browse files
App/Transcription/Utils/audio_transcription.py
CHANGED
@@ -6,6 +6,10 @@ model_size = "tiny"
|
|
6 |
|
7 |
|
8 |
def transcribe_file(state, file_path, model_size="tiny"):
|
|
|
|
|
|
|
|
|
9 |
result = {}
|
10 |
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
11 |
segments, info = model.transcribe(file_path, beam_size=5)
|
@@ -19,7 +23,6 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
19 |
},
|
20 |
)
|
21 |
|
22 |
-
|
23 |
with tqdm(total=total_duration, unit=" seconds") as pbar:
|
24 |
for segment in segments:
|
25 |
segment_duration = segment.end - segment.start
|
@@ -34,9 +37,8 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
34 |
},
|
35 |
)
|
36 |
pbar.update(segment_duration)
|
37 |
-
|
38 |
-
#delete file
|
39 |
-
os.remove(file_path)
|
40 |
|
|
|
|
|
41 |
|
42 |
return result
|
|
|
6 |
|
7 |
|
8 |
def transcribe_file(state, file_path, model_size="tiny"):
|
9 |
+
state.update_state(
|
10 |
+
state="PROGRESS",
|
11 |
+
meta={"logs": "Starting"},
|
12 |
+
)
|
13 |
result = {}
|
14 |
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
15 |
segments, info = model.transcribe(file_path, beam_size=5)
|
|
|
23 |
},
|
24 |
)
|
25 |
|
|
|
26 |
with tqdm(total=total_duration, unit=" seconds") as pbar:
|
27 |
for segment in segments:
|
28 |
segment_duration = segment.end - segment.start
|
|
|
37 |
},
|
38 |
)
|
39 |
pbar.update(segment_duration)
|
|
|
|
|
|
|
40 |
|
41 |
+
# delete file
|
42 |
+
os.remove(file_path)
|
43 |
|
44 |
return result
|