audex 1.0.7a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- audex/__init__.py +9 -0
- audex/__main__.py +7 -0
- audex/cli/__init__.py +189 -0
- audex/cli/apis/__init__.py +12 -0
- audex/cli/apis/init/__init__.py +34 -0
- audex/cli/apis/init/gencfg.py +130 -0
- audex/cli/apis/init/setup.py +330 -0
- audex/cli/apis/init/vprgroup.py +125 -0
- audex/cli/apis/serve.py +141 -0
- audex/cli/args.py +356 -0
- audex/cli/exceptions.py +44 -0
- audex/cli/helper/__init__.py +0 -0
- audex/cli/helper/ansi.py +193 -0
- audex/cli/helper/display.py +288 -0
- audex/config/__init__.py +64 -0
- audex/config/core/__init__.py +30 -0
- audex/config/core/app.py +29 -0
- audex/config/core/audio.py +45 -0
- audex/config/core/logging.py +163 -0
- audex/config/core/session.py +11 -0
- audex/config/helper/__init__.py +1 -0
- audex/config/helper/client/__init__.py +1 -0
- audex/config/helper/client/http.py +28 -0
- audex/config/helper/client/websocket.py +21 -0
- audex/config/helper/provider/__init__.py +1 -0
- audex/config/helper/provider/dashscope.py +13 -0
- audex/config/helper/provider/unisound.py +18 -0
- audex/config/helper/provider/xfyun.py +23 -0
- audex/config/infrastructure/__init__.py +31 -0
- audex/config/infrastructure/cache.py +51 -0
- audex/config/infrastructure/database.py +48 -0
- audex/config/infrastructure/recorder.py +32 -0
- audex/config/infrastructure/store.py +19 -0
- audex/config/provider/__init__.py +18 -0
- audex/config/provider/transcription.py +109 -0
- audex/config/provider/vpr.py +99 -0
- audex/container.py +40 -0
- audex/entity/__init__.py +468 -0
- audex/entity/doctor.py +109 -0
- audex/entity/doctor.pyi +51 -0
- audex/entity/fields.py +401 -0
- audex/entity/segment.py +115 -0
- audex/entity/segment.pyi +38 -0
- audex/entity/session.py +133 -0
- audex/entity/session.pyi +47 -0
- audex/entity/utterance.py +142 -0
- audex/entity/utterance.pyi +48 -0
- audex/entity/vp.py +68 -0
- audex/entity/vp.pyi +35 -0
- audex/exceptions.py +157 -0
- audex/filters/__init__.py +692 -0
- audex/filters/generated/__init__.py +21 -0
- audex/filters/generated/doctor.py +987 -0
- audex/filters/generated/segment.py +723 -0
- audex/filters/generated/session.py +978 -0
- audex/filters/generated/utterance.py +939 -0
- audex/filters/generated/vp.py +815 -0
- audex/helper/__init__.py +1 -0
- audex/helper/hash.py +33 -0
- audex/helper/mixin.py +65 -0
- audex/helper/net.py +19 -0
- audex/helper/settings/__init__.py +830 -0
- audex/helper/settings/fields.py +317 -0
- audex/helper/stream.py +153 -0
- audex/injectors/__init__.py +1 -0
- audex/injectors/config.py +12 -0
- audex/injectors/lifespan.py +7 -0
- audex/lib/__init__.py +1 -0
- audex/lib/cache/__init__.py +383 -0
- audex/lib/cache/inmemory.py +513 -0
- audex/lib/database/__init__.py +83 -0
- audex/lib/database/sqlite.py +406 -0
- audex/lib/exporter.py +189 -0
- audex/lib/injectors/__init__.py +1 -0
- audex/lib/injectors/cache.py +25 -0
- audex/lib/injectors/container.py +47 -0
- audex/lib/injectors/exporter.py +26 -0
- audex/lib/injectors/recorder.py +33 -0
- audex/lib/injectors/server.py +17 -0
- audex/lib/injectors/session.py +18 -0
- audex/lib/injectors/sqlite.py +24 -0
- audex/lib/injectors/store.py +13 -0
- audex/lib/injectors/transcription.py +42 -0
- audex/lib/injectors/usb.py +12 -0
- audex/lib/injectors/vpr.py +65 -0
- audex/lib/injectors/wifi.py +7 -0
- audex/lib/recorder.py +844 -0
- audex/lib/repos/__init__.py +149 -0
- audex/lib/repos/container.py +23 -0
- audex/lib/repos/database/__init__.py +1 -0
- audex/lib/repos/database/sqlite.py +672 -0
- audex/lib/repos/decorators.py +74 -0
- audex/lib/repos/doctor.py +286 -0
- audex/lib/repos/segment.py +302 -0
- audex/lib/repos/session.py +285 -0
- audex/lib/repos/tables/__init__.py +70 -0
- audex/lib/repos/tables/doctor.py +137 -0
- audex/lib/repos/tables/segment.py +113 -0
- audex/lib/repos/tables/session.py +140 -0
- audex/lib/repos/tables/utterance.py +131 -0
- audex/lib/repos/tables/vp.py +102 -0
- audex/lib/repos/utterance.py +288 -0
- audex/lib/repos/vp.py +286 -0
- audex/lib/restful.py +251 -0
- audex/lib/server/__init__.py +97 -0
- audex/lib/server/auth.py +98 -0
- audex/lib/server/handlers.py +248 -0
- audex/lib/server/templates/index.html.j2 +226 -0
- audex/lib/server/templates/login.html.j2 +111 -0
- audex/lib/server/templates/static/script.js +68 -0
- audex/lib/server/templates/static/style.css +579 -0
- audex/lib/server/types.py +123 -0
- audex/lib/session.py +503 -0
- audex/lib/store/__init__.py +238 -0
- audex/lib/store/localfile.py +411 -0
- audex/lib/transcription/__init__.py +33 -0
- audex/lib/transcription/dashscope.py +525 -0
- audex/lib/transcription/events.py +62 -0
- audex/lib/usb.py +554 -0
- audex/lib/vpr/__init__.py +38 -0
- audex/lib/vpr/unisound/__init__.py +185 -0
- audex/lib/vpr/unisound/types.py +469 -0
- audex/lib/vpr/xfyun/__init__.py +483 -0
- audex/lib/vpr/xfyun/types.py +679 -0
- audex/lib/websocket/__init__.py +8 -0
- audex/lib/websocket/connection.py +485 -0
- audex/lib/websocket/pool.py +991 -0
- audex/lib/wifi.py +1146 -0
- audex/lifespan.py +75 -0
- audex/service/__init__.py +27 -0
- audex/service/decorators.py +73 -0
- audex/service/doctor/__init__.py +652 -0
- audex/service/doctor/const.py +36 -0
- audex/service/doctor/exceptions.py +96 -0
- audex/service/doctor/types.py +54 -0
- audex/service/export/__init__.py +236 -0
- audex/service/export/const.py +17 -0
- audex/service/export/exceptions.py +34 -0
- audex/service/export/types.py +21 -0
- audex/service/injectors/__init__.py +1 -0
- audex/service/injectors/container.py +53 -0
- audex/service/injectors/doctor.py +34 -0
- audex/service/injectors/export.py +27 -0
- audex/service/injectors/session.py +49 -0
- audex/service/session/__init__.py +754 -0
- audex/service/session/const.py +34 -0
- audex/service/session/exceptions.py +67 -0
- audex/service/session/types.py +91 -0
- audex/types.py +39 -0
- audex/utils.py +287 -0
- audex/valueobj/__init__.py +81 -0
- audex/valueobj/common/__init__.py +1 -0
- audex/valueobj/common/auth.py +84 -0
- audex/valueobj/common/email.py +16 -0
- audex/valueobj/common/ops.py +22 -0
- audex/valueobj/common/phone.py +84 -0
- audex/valueobj/common/version.py +72 -0
- audex/valueobj/session.py +19 -0
- audex/valueobj/utterance.py +15 -0
- audex/view/__init__.py +51 -0
- audex/view/container.py +17 -0
- audex/view/decorators.py +303 -0
- audex/view/pages/__init__.py +1 -0
- audex/view/pages/dashboard/__init__.py +286 -0
- audex/view/pages/dashboard/wifi.py +407 -0
- audex/view/pages/login.py +110 -0
- audex/view/pages/recording.py +348 -0
- audex/view/pages/register.py +202 -0
- audex/view/pages/sessions/__init__.py +196 -0
- audex/view/pages/sessions/details.py +224 -0
- audex/view/pages/sessions/export.py +443 -0
- audex/view/pages/settings.py +374 -0
- audex/view/pages/voiceprint/__init__.py +1 -0
- audex/view/pages/voiceprint/enroll.py +195 -0
- audex/view/pages/voiceprint/update.py +195 -0
- audex/view/static/css/dashboard.css +452 -0
- audex/view/static/css/glass.css +22 -0
- audex/view/static/css/global.css +541 -0
- audex/view/static/css/login.css +386 -0
- audex/view/static/css/recording.css +439 -0
- audex/view/static/css/register.css +293 -0
- audex/view/static/css/sessions/styles.css +501 -0
- audex/view/static/css/settings.css +186 -0
- audex/view/static/css/voiceprint/enroll.css +43 -0
- audex/view/static/css/voiceprint/styles.css +209 -0
- audex/view/static/css/voiceprint/update.css +44 -0
- audex/view/static/images/logo.svg +95 -0
- audex/view/static/js/recording.js +42 -0
- audex-1.0.7a3.dist-info/METADATA +361 -0
- audex-1.0.7a3.dist-info/RECORD +192 -0
- audex-1.0.7a3.dist-info/WHEEL +4 -0
- audex-1.0.7a3.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
if t.TYPE_CHECKING:
|
|
6
|
+
from audex.config import Config
|
|
7
|
+
from audex.lib.recorder import AudioRecorder
|
|
8
|
+
from audex.lib.store import Store
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def make_recorder(config: Config, store: Store) -> AudioRecorder:
|
|
12
|
+
import pyaudio
|
|
13
|
+
|
|
14
|
+
from audex.lib.recorder import AudioConfig
|
|
15
|
+
from audex.lib.recorder import AudioRecorder
|
|
16
|
+
|
|
17
|
+
fmt = {
|
|
18
|
+
"float32": pyaudio.paFloat32,
|
|
19
|
+
"int32": pyaudio.paInt32,
|
|
20
|
+
"int16": pyaudio.paInt16,
|
|
21
|
+
"int8": pyaudio.paInt8,
|
|
22
|
+
"uint8": pyaudio.paUInt8,
|
|
23
|
+
}
|
|
24
|
+
return AudioRecorder(
|
|
25
|
+
store=store,
|
|
26
|
+
config=AudioConfig(
|
|
27
|
+
format=fmt[config.infrastructure.recorder.format],
|
|
28
|
+
channels=config.infrastructure.recorder.channels,
|
|
29
|
+
rate=config.core.audio.sample_rate,
|
|
30
|
+
chunk=config.infrastructure.recorder.chunk,
|
|
31
|
+
input_device_index=config.infrastructure.recorder.input_device_index,
|
|
32
|
+
),
|
|
33
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
if t.TYPE_CHECKING:
|
|
6
|
+
from audex.lib.exporter import Exporter
|
|
7
|
+
from audex.lib.repos.doctor import DoctorRepository
|
|
8
|
+
from audex.lib.server import Server
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def make_server(
|
|
12
|
+
doctor_repo: DoctorRepository,
|
|
13
|
+
exporter: Exporter,
|
|
14
|
+
) -> Server:
|
|
15
|
+
from audex.lib.server import Server
|
|
16
|
+
|
|
17
|
+
return Server(doctor_repo=doctor_repo, exporter=exporter)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
if t.TYPE_CHECKING:
|
|
6
|
+
from audex.config import Config
|
|
7
|
+
from audex.lib.session import SessionManager
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def make_session_manager(config: Config) -> SessionManager:
|
|
11
|
+
import datetime
|
|
12
|
+
|
|
13
|
+
from audex.lib.session import SessionManager
|
|
14
|
+
|
|
15
|
+
return SessionManager(
|
|
16
|
+
app_name=config.core.app.app_name,
|
|
17
|
+
ttl=datetime.timedelta(hours=config.core.session.ttl_hours),
|
|
18
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
if t.TYPE_CHECKING:
|
|
6
|
+
from audex.config import Config
|
|
7
|
+
from audex.lib.database.sqlite import SQLite
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def make_sqlite(config: Config) -> SQLite:
|
|
11
|
+
from audex.lib.database.sqlite import SQLite
|
|
12
|
+
from audex.lib.repos.tables import TABLES
|
|
13
|
+
|
|
14
|
+
return SQLite(
|
|
15
|
+
uri=config.infrastructure.sqlite.uri,
|
|
16
|
+
tables=list(TABLES),
|
|
17
|
+
echo=config.infrastructure.sqlite.echo,
|
|
18
|
+
pool_size=config.infrastructure.sqlite.pool_size,
|
|
19
|
+
max_overflow=config.infrastructure.sqlite.max_overflow,
|
|
20
|
+
pool_recycle=config.infrastructure.sqlite.pool_recycle,
|
|
21
|
+
pool_timeout=config.infrastructure.sqlite.pool_timeout,
|
|
22
|
+
pool_pre_ping=config.infrastructure.sqlite.pool_pre_ping,
|
|
23
|
+
create_all=config.infrastructure.sqlite.create_all,
|
|
24
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
if t.TYPE_CHECKING:
|
|
6
|
+
from audex.config import Config
|
|
7
|
+
from audex.lib.store import Store
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def make_store(config: Config) -> Store:
|
|
11
|
+
from audex.lib.store.localfile import LocalFileStore
|
|
12
|
+
|
|
13
|
+
return LocalFileStore(config.infrastructure.store.base_url)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
from audex.exceptions import ConfigurationError
|
|
6
|
+
from audex.utils import Unset
|
|
7
|
+
|
|
8
|
+
if t.TYPE_CHECKING:
|
|
9
|
+
from audex.config import Config
|
|
10
|
+
from audex.lib.transcription import Transcription
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def make_transcription(config: Config) -> Transcription:
|
|
14
|
+
if isinstance(config.provider.transcription.dashscope.credential.api_key, Unset):
|
|
15
|
+
raise ConfigurationError(
|
|
16
|
+
config_key="provider.transcription.dashscope.credential.api_key",
|
|
17
|
+
reason="missing",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from audex.lib.transcription.dashscope import DashscopeParaformer
|
|
21
|
+
|
|
22
|
+
return DashscopeParaformer(
|
|
23
|
+
model=config.provider.transcription.dashscope.model,
|
|
24
|
+
api_key=config.provider.transcription.dashscope.credential.api_key,
|
|
25
|
+
user_agent=config.provider.transcription.dashscope.user_agent,
|
|
26
|
+
workspace=config.provider.transcription.dashscope.workspace,
|
|
27
|
+
max_connections=config.provider.transcription.dashscope.websocket.max_connections,
|
|
28
|
+
idle_timeout=config.provider.transcription.dashscope.websocket.idle_timeout,
|
|
29
|
+
drain_timeout=config.provider.transcription.dashscope.websocket.drain_timeout,
|
|
30
|
+
fmt=config.provider.transcription.dashscope.session.fmt,
|
|
31
|
+
sample_rate=config.core.audio.sample_rate,
|
|
32
|
+
silence_duration_ms=config.provider.transcription.dashscope.session.silence_duration_ms,
|
|
33
|
+
vocabulary_id=config.provider.transcription.dashscope.session.vocabulary_id,
|
|
34
|
+
disfluency_removal_enabled=config.provider.transcription.dashscope.session.disfluency_removal_enabled,
|
|
35
|
+
lang_hints=config.provider.transcription.dashscope.session.lang_hints,
|
|
36
|
+
semantic_punctuation=config.provider.transcription.dashscope.session.semantic_punctuation,
|
|
37
|
+
multi_thres_mode=config.provider.transcription.dashscope.session.multi_thres_mode,
|
|
38
|
+
punctuation_pred=config.provider.transcription.dashscope.session.punctuation_pred,
|
|
39
|
+
heartbeat=config.provider.transcription.dashscope.session.heartbeat,
|
|
40
|
+
itn=config.provider.transcription.dashscope.session.itn,
|
|
41
|
+
resources=config.provider.transcription.dashscope.session.resources,
|
|
42
|
+
)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
from audex.exceptions import ConfigurationError
|
|
6
|
+
from audex.utils import Unset
|
|
7
|
+
|
|
8
|
+
if t.TYPE_CHECKING:
|
|
9
|
+
from audex.config import Config
|
|
10
|
+
from audex.lib.vpr import VPR
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def make_vpr(config: Config) -> VPR:
|
|
14
|
+
if config.provider.vpr.provider == "xfyun":
|
|
15
|
+
if isinstance(config.provider.vpr.xfyun.credential.app_id, Unset):
|
|
16
|
+
raise ConfigurationError(
|
|
17
|
+
config_key="provider.vpr.xfyun.credential.app_id",
|
|
18
|
+
reason="missing",
|
|
19
|
+
)
|
|
20
|
+
if isinstance(config.provider.vpr.xfyun.credential.api_key, Unset):
|
|
21
|
+
raise ConfigurationError(
|
|
22
|
+
config_key="provider.vpr.xfyun.credential.api_key",
|
|
23
|
+
reason="missing",
|
|
24
|
+
)
|
|
25
|
+
if isinstance(config.provider.vpr.xfyun.credential.api_secret, Unset):
|
|
26
|
+
raise ConfigurationError(
|
|
27
|
+
config_key="provider.vpr.xfyun.credential.api_secret",
|
|
28
|
+
reason="missing",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
from audex.lib.vpr.xfyun import XFYunVPR
|
|
32
|
+
|
|
33
|
+
return XFYunVPR(
|
|
34
|
+
app_id=config.provider.vpr.xfyun.credential.app_id,
|
|
35
|
+
api_key=config.provider.vpr.xfyun.credential.api_key,
|
|
36
|
+
api_secret=config.provider.vpr.xfyun.credential.api_secret,
|
|
37
|
+
group_id=config.provider.vpr.xfyun.group_id,
|
|
38
|
+
proxy=config.provider.vpr.xfyun.http.proxy,
|
|
39
|
+
timeout=config.provider.vpr.xfyun.http.timeout,
|
|
40
|
+
default_headers=config.provider.vpr.xfyun.http.default_headers,
|
|
41
|
+
default_params=config.provider.vpr.xfyun.http.default_params,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if isinstance(config.provider.vpr.unisound.credential.appkey, Unset):
|
|
45
|
+
raise ConfigurationError(
|
|
46
|
+
config_key="provider.vpr.unisound.credential.appkey",
|
|
47
|
+
reason="missing",
|
|
48
|
+
)
|
|
49
|
+
if isinstance(config.provider.vpr.unisound.credential.secret, Unset):
|
|
50
|
+
raise ConfigurationError(
|
|
51
|
+
config_key="provider.vpr.unisound.credential.secret",
|
|
52
|
+
reason="missing",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
from audex.lib.vpr.unisound import UnisoundVPR
|
|
56
|
+
|
|
57
|
+
return UnisoundVPR(
|
|
58
|
+
appkey=config.provider.vpr.unisound.credential.appkey,
|
|
59
|
+
secret=config.provider.vpr.unisound.credential.secret,
|
|
60
|
+
group_id=config.provider.vpr.unisound.group_id,
|
|
61
|
+
proxy=config.provider.vpr.unisound.http.proxy,
|
|
62
|
+
timeout=config.provider.vpr.unisound.http.timeout,
|
|
63
|
+
default_headers=config.provider.vpr.unisound.http.default_headers,
|
|
64
|
+
default_params=config.provider.vpr.unisound.http.default_params,
|
|
65
|
+
)
|