changed the format of the results
Browse files
App/Transcription/Utils/audio_transcription.py
CHANGED
@@ -7,7 +7,7 @@ model_size = "tiny"
|
|
7 |
|
8 |
|
9 |
def transcribe_file(state, file_path, model_size="tiny"):
|
10 |
-
result =
|
11 |
metadata = TranscriptionMetadata()
|
12 |
metadata.logs = "Transcription STARTING"
|
13 |
state.update_state(
|
@@ -33,8 +33,13 @@ 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 |
metadata.logs = "Transcribing.."
|
39 |
metadata.percentage = f"{((segment.end / total_duration)*100)}"
|
40 |
state.update_state(state="PROGRESS", meta=metadata.dict())
|
|
|
7 |
|
8 |
|
9 |
def transcribe_file(state, file_path, model_size="tiny"):
|
10 |
+
result = []
|
11 |
metadata = TranscriptionMetadata()
|
12 |
metadata.logs = "Transcription STARTING"
|
13 |
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 |
+
temp = {
|
37 |
+
"start": segment.start,
|
38 |
+
"end": segment.end,
|
39 |
+
"text": segment.text,
|
40 |
+
}
|
41 |
+
# time_stamp = "[%.2fs -> %.2fs]" % (segment.start, segment.end)
|
42 |
+
result.append(temp)
|
43 |
metadata.logs = "Transcribing.."
|
44 |
metadata.percentage = f"{((segment.end / total_duration)*100)}"
|
45 |
state.update_state(state="PROGRESS", meta=metadata.dict())
|