word level fix?
Browse files
App/Transcription/Utils/audio_transcription.py
CHANGED
@@ -34,18 +34,18 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
34 |
try:
|
35 |
with tqdm(total=total_duration, unit=" seconds") as pbar:
|
36 |
for segment in segments:
|
37 |
-
segment_duration = segment.end - segment.start
|
38 |
for word in segment.words:
|
|
|
39 |
temp = {
|
40 |
"start": word.start,
|
41 |
"end": word.end,
|
42 |
"text": word.text,
|
43 |
}
|
44 |
result.append(temp)
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
except Exception as e:
|
50 |
metadata.logs = f"Falied error {e}"
|
51 |
state.update_state(
|
|
|
34 |
try:
|
35 |
with tqdm(total=total_duration, unit=" seconds") as pbar:
|
36 |
for segment in segments:
|
|
|
37 |
for word in segment.words:
|
38 |
+
segment_duration = word.end - word.start
|
39 |
temp = {
|
40 |
"start": word.start,
|
41 |
"end": word.end,
|
42 |
"text": word.text,
|
43 |
}
|
44 |
result.append(temp)
|
45 |
+
metadata.logs = "Transcribing.."
|
46 |
+
metadata.percentage = f"{((word.end / total_duration)*100)}"
|
47 |
+
state.update_state(state="PROGRESS", meta=metadata.dict())
|
48 |
+
pbar.update(segment_duration)
|
49 |
except Exception as e:
|
50 |
metadata.logs = f"Falied error {e}"
|
51 |
state.update_state(
|