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