most-client 1.0.14__tar.gz → 1.0.15__tar.gz
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.
- {most_client-1.0.14/most_client.egg-info → most_client-1.0.15}/PKG-INFO +1 -1
- {most_client-1.0.14 → most_client-1.0.15}/most/api.py +11 -1
- {most_client-1.0.14 → most_client-1.0.15}/most/async_api.py +11 -1
- {most_client-1.0.14 → most_client-1.0.15}/most/types.py +36 -0
- {most_client-1.0.14 → most_client-1.0.15/most_client.egg-info}/PKG-INFO +1 -1
- {most_client-1.0.14 → most_client-1.0.15}/setup.py +1 -1
- {most_client-1.0.14 → most_client-1.0.15}/MANIFEST.in +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/README.md +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most/__init__.py +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most_client.egg-info/SOURCES.txt +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most_client.egg-info/dependency_links.txt +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most_client.egg-info/requires.txt +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most_client.egg-info/top_level.txt +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/most_client.egg-info/zip-safe +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/requirements.txt +0 -0
- {most_client-1.0.14 → most_client-1.0.15}/setup.cfg +0 -0
@@ -2,7 +2,7 @@ from typing import List, Dict
|
|
2
2
|
import json5
|
3
3
|
import requests
|
4
4
|
from adaptix import Retort
|
5
|
-
from most.types import Audio, Result, Script, JobStatus, Text, StoredAudioData, is_valid_id
|
5
|
+
from most.types import Audio, Result, Script, JobStatus, Text, StoredAudioData, is_valid_id, DialogResult
|
6
6
|
from pathlib import Path
|
7
7
|
|
8
8
|
|
@@ -205,6 +205,16 @@ class MostClient(object):
|
|
205
205
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
206
206
|
return self.retort.load(resp.json(), Result)
|
207
207
|
|
208
|
+
def fetch_dialog(self, audio_id) -> DialogResult:
|
209
|
+
if not is_valid_id(self.model_id):
|
210
|
+
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
211
|
+
|
212
|
+
if not is_valid_id(audio_id):
|
213
|
+
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
214
|
+
|
215
|
+
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
216
|
+
return self.retort.load(resp.json(), DialogResult)
|
217
|
+
|
208
218
|
def export(self, audio_ids: List[str]) -> str:
|
209
219
|
if not is_valid_id(self.model_id):
|
210
220
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import List, Dict
|
2
2
|
import json5
|
3
3
|
from adaptix import Retort
|
4
|
-
from most.types import Audio, Result, Script, JobStatus, Text, StoredAudioData, is_valid_id
|
4
|
+
from most.types import Audio, Result, Script, JobStatus, Text, StoredAudioData, is_valid_id, DialogResult
|
5
5
|
from pathlib import Path
|
6
6
|
import httpx
|
7
7
|
|
@@ -214,6 +214,16 @@ class AsyncMostClient(object):
|
|
214
214
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
215
215
|
return self.retort.load(resp.json(), Result)
|
216
216
|
|
217
|
+
async def fetch_dialog(self, audio_id) -> DialogResult:
|
218
|
+
if not is_valid_id(self.model_id):
|
219
|
+
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
220
|
+
|
221
|
+
if not is_valid_id(audio_id):
|
222
|
+
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
223
|
+
|
224
|
+
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
225
|
+
return self.retort.load(resp.json(), DialogResult)
|
226
|
+
|
217
227
|
async def export(self, audio_ids: List[str]) -> str:
|
218
228
|
if not is_valid_id(self.model_id):
|
219
229
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
@@ -76,6 +76,42 @@ class Result(DataClassJsonMixin):
|
|
76
76
|
for column_result in self.results])
|
77
77
|
|
78
78
|
|
79
|
+
@dataclass_json
|
80
|
+
@dataclass
|
81
|
+
class DialogSegment(DataClassJsonMixin):
|
82
|
+
start_time_ms: int
|
83
|
+
end_time_ms: int
|
84
|
+
text: str
|
85
|
+
speaker: str
|
86
|
+
emotion: Optional[str] = None
|
87
|
+
intensity: Optional[float] = None
|
88
|
+
|
89
|
+
def to_text(self):
|
90
|
+
if self.emotion is None:
|
91
|
+
return f'{self.speaker}: {self.text}\n'
|
92
|
+
else:
|
93
|
+
return f'{self.speaker}: <emotion name="{self.emotion}" intensity="{self.intensity}">{self.text}</emotion>\n'
|
94
|
+
|
95
|
+
|
96
|
+
@dataclass_json
|
97
|
+
@dataclass
|
98
|
+
class Dialog(DataClassJsonMixin):
|
99
|
+
segments: List[DialogSegment]
|
100
|
+
|
101
|
+
def to_text(self):
|
102
|
+
return ''.join([segment.to_text()
|
103
|
+
for segment in self.segments])
|
104
|
+
|
105
|
+
|
106
|
+
@dataclass_json
|
107
|
+
@dataclass
|
108
|
+
class DialogResult(DataClassJsonMixin):
|
109
|
+
id: str
|
110
|
+
dialog: Optional[Dialog]
|
111
|
+
url: Optional[str]
|
112
|
+
results: Optional[List[ColumnResult]]
|
113
|
+
|
114
|
+
|
79
115
|
def is_valid_objectid(oid: str) -> bool:
|
80
116
|
"""
|
81
117
|
Check if a given string is a valid MongoDB ObjectId (24-character hex).
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|