removed logs
Browse files
App/Transcription/Schemas.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
from pydantic import BaseModel, Field
|
|
|
2 |
from datetime import datetime
|
3 |
|
4 |
|
5 |
class TranscriptionMetadata(BaseModel):
|
6 |
duration: int = 0
|
7 |
language: str = "-"
|
8 |
-
logs: str = ""
|
9 |
percentage: str = "-"
|
10 |
transcription: dict = {}
|
11 |
state: str = "PENDING"
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
+
from typing import Optional
|
3 |
from datetime import datetime
|
4 |
|
5 |
|
6 |
class TranscriptionMetadata(BaseModel):
|
7 |
duration: int = 0
|
8 |
language: str = "-"
|
|
|
9 |
percentage: str = "-"
|
10 |
transcription: dict = {}
|
11 |
state: str = "PENDING"
|
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -116,7 +116,7 @@ async def get_status(task_id):
|
|
116 |
)
|
117 |
else:
|
118 |
_trans = TranscriptionMetadata(**task_result.result)
|
119 |
-
await entry.update(**_trans.dict(exclude={"
|
120 |
|
121 |
result = {
|
122 |
"task_id": task_id,
|
|
|
116 |
)
|
117 |
else:
|
118 |
_trans = TranscriptionMetadata(**task_result.result)
|
119 |
+
await entry.update(**_trans.dict(exclude={"transcription"}))
|
120 |
|
121 |
result = {
|
122 |
"task_id": task_id,
|
App/Transcription/Utils/audio_transcription.py
CHANGED
@@ -11,7 +11,6 @@ model_size = "tiny"
|
|
11 |
def transcribe_file(state, file_path, model_size="tiny"):
|
12 |
result = []
|
13 |
metadata = TranscriptionMetadata()
|
14 |
-
metadata.logs = "Transcription STARTING"
|
15 |
start_time = datetime.now()
|
16 |
state.update_state(
|
17 |
state="PROGRESS",
|
@@ -23,10 +22,6 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
23 |
)
|
24 |
|
25 |
total_duration = round(info.duration, 2)
|
26 |
-
metadata.logs = (
|
27 |
-
"Detected language '%s' with probability %f"
|
28 |
-
% (info.language, info.language_probability),
|
29 |
-
)
|
30 |
metadata.language = info.language
|
31 |
metadata.duration = int(total_duration)
|
32 |
state.update_state(
|
@@ -47,12 +42,10 @@ def transcribe_file(state, file_path, model_size="tiny"):
|
|
47 |
result.append(temp)
|
48 |
time_difference = datetime.now() - start_time
|
49 |
if time_difference >= timedelta(seconds=30):
|
50 |
-
metadata.logs = "Transcribing.."
|
51 |
metadata.percentage = f"{((word.end / total_duration)*100)}"
|
52 |
state.update_state(state="PROGRESS", meta=metadata.dict())
|
53 |
pbar.update(segment_duration)
|
54 |
except Exception as e:
|
55 |
-
metadata.logs = f"Falied error {e}"
|
56 |
state.update_state(
|
57 |
state="FAILED",
|
58 |
meta=metadata.dict(),
|
|
|
11 |
def transcribe_file(state, file_path, model_size="tiny"):
|
12 |
result = []
|
13 |
metadata = TranscriptionMetadata()
|
|
|
14 |
start_time = datetime.now()
|
15 |
state.update_state(
|
16 |
state="PROGRESS",
|
|
|
22 |
)
|
23 |
|
24 |
total_duration = round(info.duration, 2)
|
|
|
|
|
|
|
|
|
25 |
metadata.language = info.language
|
26 |
metadata.duration = int(total_duration)
|
27 |
state.update_state(
|
|
|
42 |
result.append(temp)
|
43 |
time_difference = datetime.now() - start_time
|
44 |
if time_difference >= timedelta(seconds=30):
|
|
|
45 |
metadata.percentage = f"{((word.end / total_duration)*100)}"
|
46 |
state.update_state(state="PROGRESS", meta=metadata.dict())
|
47 |
pbar.update(segment_duration)
|
48 |
except Exception as e:
|
|
|
49 |
state.update_state(
|
50 |
state="FAILED",
|
51 |
meta=metadata.dict(),
|