most-client 1.0.16__py3-none-any.whl → 1.0.18__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.
- most/api.py +16 -5
- most/async_api.py +16 -5
- {most_client-1.0.16.dist-info → most_client-1.0.18.dist-info}/METADATA +1 -1
- most_client-1.0.18.dist-info/RECORD +9 -0
- most_client-1.0.16.dist-info/RECORD +0 -9
- {most_client-1.0.16.dist-info → most_client-1.0.18.dist-info}/WHEEL +0 -0
- {most_client-1.0.16.dist-info → most_client-1.0.18.dist-info}/top_level.txt +0 -0
- {most_client-1.0.16.dist-info → most_client-1.0.18.dist-info}/zip-safe +0 -0
most/api.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import io
|
2
2
|
import os
|
3
|
+
import uuid
|
3
4
|
from pathlib import Path
|
4
|
-
from typing import Dict, List
|
5
|
+
from typing import Dict, List, Optional
|
5
6
|
|
6
7
|
import json5
|
7
8
|
import requests
|
@@ -145,12 +146,15 @@ class MostClient(object):
|
|
145
146
|
files={"audio_file": f})
|
146
147
|
return self.retort.load(resp.json(), Audio)
|
147
148
|
|
148
|
-
def upload_audio_segment(self, audio: AudioSegment
|
149
|
+
def upload_audio_segment(self, audio: AudioSegment,
|
150
|
+
audio_name: Optional[str] = None) -> Audio:
|
149
151
|
f = io.BytesIO()
|
150
152
|
audio.export(f, format="mp3")
|
151
153
|
f.seek(0)
|
154
|
+
if audio_name is None:
|
155
|
+
audio_name = uuid.uuid4().hex + ".mp3"
|
152
156
|
resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
153
|
-
files={"audio_file": f})
|
157
|
+
files={"audio_file": (audio_name, f, 'audio/mp3')})
|
154
158
|
return self.retort.load(resp.json(), Audio)
|
155
159
|
|
156
160
|
def upload_audio_url(self, audio_url) -> Audio:
|
@@ -237,12 +241,19 @@ class MostClient(object):
|
|
237
241
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
238
242
|
return self.retort.load(resp.json(), DialogResult)
|
239
243
|
|
240
|
-
def export(self, audio_ids: List[str]
|
244
|
+
def export(self, audio_ids: List[str],
|
245
|
+
aggregated_by: Optional[str] = None,
|
246
|
+
aggregation_title: Optional[str] = None) -> str:
|
247
|
+
if aggregation_title is None:
|
248
|
+
aggregation_title = aggregated_by
|
249
|
+
|
241
250
|
if not is_valid_id(self.model_id):
|
242
251
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
243
252
|
|
244
253
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
245
|
-
params={'audio_ids': ','.join(audio_ids)
|
254
|
+
params={'audio_ids': ','.join(audio_ids),
|
255
|
+
'aggregated_by': aggregated_by,
|
256
|
+
'aggregation_title': aggregation_title})
|
246
257
|
return resp.url
|
247
258
|
|
248
259
|
def store_info(self,
|
most/async_api.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import io
|
2
2
|
import os
|
3
|
+
import uuid
|
3
4
|
from pathlib import Path
|
4
|
-
from typing import Dict, List
|
5
|
+
from typing import Dict, List, Optional
|
5
6
|
|
6
7
|
import httpx
|
7
8
|
import json5
|
@@ -149,12 +150,15 @@ class AsyncMostClient(object):
|
|
149
150
|
files={"audio_file": f})
|
150
151
|
return self.retort.load(resp.json(), Audio)
|
151
152
|
|
152
|
-
async def upload_audio_segment(self, audio: AudioSegment
|
153
|
+
async def upload_audio_segment(self, audio: AudioSegment,
|
154
|
+
audio_name: Optional[str] = None) -> Audio:
|
153
155
|
f = io.BytesIO()
|
154
156
|
audio.export(f, format="mp3")
|
155
157
|
f.seek(0)
|
158
|
+
if audio_name is None:
|
159
|
+
audio_name = uuid.uuid4().hex + ".mp3"
|
156
160
|
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
157
|
-
files={"audio_file": f})
|
161
|
+
files={"audio_file": (audio_name, f, 'audio/mp3')})
|
158
162
|
return self.retort.load(resp.json(), Audio)
|
159
163
|
|
160
164
|
async def upload_text(self, text: str) -> Text:
|
@@ -246,12 +250,19 @@ class AsyncMostClient(object):
|
|
246
250
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
247
251
|
return self.retort.load(resp.json(), DialogResult)
|
248
252
|
|
249
|
-
async def export(self, audio_ids: List[str]
|
253
|
+
async def export(self, audio_ids: List[str],
|
254
|
+
aggregated_by: Optional[str] = None,
|
255
|
+
aggregation_title: Optional[str] = None) -> str:
|
256
|
+
if aggregation_title is None:
|
257
|
+
aggregation_title = aggregated_by
|
258
|
+
|
250
259
|
if not is_valid_id(self.model_id):
|
251
260
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
252
261
|
|
253
262
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
254
|
-
params={'audio_ids': ','.join(audio_ids)
|
263
|
+
params={'audio_ids': ','.join(audio_ids),
|
264
|
+
"aggregated_by": aggregated_by,
|
265
|
+
"aggregation_title": aggregation_title})
|
255
266
|
return resp.next_request.url
|
256
267
|
|
257
268
|
async def store_info(self,
|
@@ -0,0 +1,9 @@
|
|
1
|
+
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
+
most/api.py,sha256=IvgklvaP9fvcr_fy-gGvnEDWcyxPRTxNN0MO492YgT0,12101
|
3
|
+
most/async_api.py,sha256=tFFLTWhGVexVz5v9hYuNp4BqFEWTNSp_6DLSAQBjF9c,12858
|
4
|
+
most/types.py,sha256=apUz6FHFAHWJNVvRh57wVQk5DFw2XKnLLhkAyWgtvfw,2825
|
5
|
+
most_client-1.0.18.dist-info/METADATA,sha256=bJfi-Nsqkp3oHirr417vvUtJgo79AzaCOqsBUSUJq58,1027
|
6
|
+
most_client-1.0.18.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
7
|
+
most_client-1.0.18.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
8
|
+
most_client-1.0.18.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
9
|
+
most_client-1.0.18.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
-
most/api.py,sha256=WCqoiEWJHT3CjJMtMYpLLiPdFfuWm6dZlAUTcHHIF2s,11578
|
3
|
-
most/async_api.py,sha256=frSdPUCBqgmfSyCdW36jBtZvNn1EtM67kR1a4ww0BNo,12305
|
4
|
-
most/types.py,sha256=apUz6FHFAHWJNVvRh57wVQk5DFw2XKnLLhkAyWgtvfw,2825
|
5
|
-
most_client-1.0.16.dist-info/METADATA,sha256=ZYksiJjL2z3czgL9B9YWYMqDOP4YG3_cTDki1TAhGP4,1027
|
6
|
-
most_client-1.0.16.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
7
|
-
most_client-1.0.16.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
8
|
-
most_client-1.0.16.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
9
|
-
most_client-1.0.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|