reduce logging
Browse files
App/Transcription/Utils/audio_transcription.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
from faster_whisper import WhisperModel
|
2 |
from tqdm import tqdm
|
3 |
-
import os
|
4 |
from App.Transcription.Schemas import TranscriptionMetadata
|
5 |
|
|
|
6 |
model_size = "tiny"
|
7 |
|
8 |
|
@@ -42,9 +43,11 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
42 |
"text": word.word,
|
43 |
}
|
44 |
result.append(temp)
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
pbar.update(segment_duration)
|
49 |
except Exception as e:
|
50 |
metadata.logs = f"Falied error {e}"
|
|
|
1 |
from faster_whisper import WhisperModel
|
2 |
from tqdm import tqdm
|
3 |
+
import os, time
|
4 |
from App.Transcription.Schemas import TranscriptionMetadata
|
5 |
|
6 |
+
current_time = time.localtime()
|
7 |
model_size = "tiny"
|
8 |
|
9 |
|
|
|
43 |
"text": word.word,
|
44 |
}
|
45 |
result.append(temp)
|
46 |
+
|
47 |
+
if current_time.tm_sec == 0:
|
48 |
+
metadata.logs = "Transcribing.."
|
49 |
+
metadata.percentage = f"{((word.end / total_duration)*100)}"
|
50 |
+
state.update_state(state="PROGRESS", meta=metadata.dict())
|
51 |
pbar.update(segment_duration)
|
52 |
except Exception as e:
|
53 |
metadata.logs = f"Falied error {e}"
|