most-client 1.0.21__py3-none-any.whl → 1.0.23__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 CHANGED
@@ -18,7 +18,7 @@ from most.types import (
18
18
  Script,
19
19
  StoredAudioData,
20
20
  Text,
21
- is_valid_id, SearchParams, ScriptScoreMapping,
21
+ is_valid_id, SearchParams, ScriptScoreMapping, Dialog,
22
22
  )
23
23
 
24
24
 
@@ -144,6 +144,11 @@ class MostClient(object):
144
144
  files={"text": text})
145
145
  return self.retort.load(resp.json(), Text)
146
146
 
147
+ def upload_dialog(self, dialog: Dialog) -> DialogResult:
148
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_dialog",
149
+ json={"dialog": dialog})
150
+ return self.retort.load(resp.json(), DialogResult)
151
+
147
152
  def upload_audio(self, audio_path) -> Audio:
148
153
  with open(audio_path, 'rb') as f:
149
154
  resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
@@ -173,6 +178,13 @@ class MostClient(object):
173
178
  audio_list = resp.json()
174
179
  return self.retort.load(audio_list, List[Audio])
175
180
 
181
+ def list_texts(self,
182
+ offset: int = 0,
183
+ limit: int = 10) -> List[Text]:
184
+ resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/list_texts?offset={offset}&limit={limit}")
185
+ texts_list = resp.json()
186
+ return self.retort.load(texts_list, List[Text])
187
+
176
188
  def get_model_script(self) -> Script:
177
189
  if not is_valid_id(self.model_id):
178
190
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -209,6 +221,20 @@ class MostClient(object):
209
221
  result = self.score_modifier.modify(result)
210
222
  return result
211
223
 
224
+ def apply_on_text(self, text_id,
225
+ modify_scores: bool = False) -> Result:
226
+ if not is_valid_id(self.model_id):
227
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
228
+
229
+ if not is_valid_id(text_id):
230
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
231
+
232
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply")
233
+ result = self.retort.load(resp.json(), Result)
234
+ if modify_scores:
235
+ result = self.score_modifier.modify(result)
236
+ return result
237
+
212
238
  def apply_later(self, audio_id,
213
239
  modify_scores: bool = False) -> Result:
214
240
  if not is_valid_id(self.model_id):
@@ -223,6 +249,20 @@ class MostClient(object):
223
249
  result = self.score_modifier.modify(result)
224
250
  return result
225
251
 
252
+ def apply_on_text_later(self, text_id,
253
+ modify_scores: bool = False) -> Result:
254
+ if not is_valid_id(self.model_id):
255
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
256
+
257
+ if not is_valid_id(text_id):
258
+ raise RuntimeError("Please use valid text_id. [try audio.id from list_texts()]")
259
+
260
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply_async")
261
+ result = self.retort.load(resp.json(), Result)
262
+ if modify_scores:
263
+ result = self.score_modifier.modify(result)
264
+ return result
265
+
226
266
  def get_job_status(self, audio_id) -> JobStatus:
227
267
  if not is_valid_id(self.model_id):
228
268
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
most/async_api.py CHANGED
@@ -18,7 +18,7 @@ from most.types import (
18
18
  Script,
19
19
  StoredAudioData,
20
20
  Text,
21
- is_valid_id, SearchParams, ScriptScoreMapping,
21
+ is_valid_id, SearchParams, ScriptScoreMapping, Dialog,
22
22
  )
23
23
 
24
24
 
@@ -170,6 +170,11 @@ class AsyncMostClient(object):
170
170
  json={"text": text})
171
171
  return self.retort.load(resp.json(), Text)
172
172
 
173
+ async def upload_dialog(self, dialog: Dialog) -> DialogResult:
174
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_dialog",
175
+ json={"dialog": dialog})
176
+ return self.retort.load(resp.json(), DialogResult)
177
+
173
178
  async def upload_audio_url(self, audio_url) -> Audio:
174
179
  resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_url",
175
180
  json={"audio_url": audio_url})
@@ -182,6 +187,13 @@ class AsyncMostClient(object):
182
187
  audio_list = resp.json()
183
188
  return self.retort.load(audio_list, List[Audio])
184
189
 
190
+ async def list_texts(self,
191
+ offset: int = 0,
192
+ limit: int = 10) -> List[Text]:
193
+ resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/list_texts?offset={offset}&limit={limit}")
194
+ texts_list = resp.json()
195
+ return self.retort.load(texts_list, List[Text])
196
+
185
197
  async def get_model_script(self) -> Script:
186
198
  if not is_valid_id(self.model_id):
187
199
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -218,6 +230,20 @@ class AsyncMostClient(object):
218
230
  result = self.score_modifier.modify(result)
219
231
  return result
220
232
 
233
+ async def apply_on_text(self, text_id,
234
+ modify_scores: bool = False) -> Result:
235
+ if not is_valid_id(self.model_id):
236
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
237
+
238
+ if not is_valid_id(text_id):
239
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
240
+
241
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply")
242
+ result = self.retort.load(resp.json(), Result)
243
+ if modify_scores:
244
+ result = self.score_modifier.modify(result)
245
+ return result
246
+
221
247
  async def apply_later(self, audio_id,
222
248
  modify_scores: bool = False) -> Result:
223
249
  if not is_valid_id(self.model_id):
@@ -232,6 +258,20 @@ class AsyncMostClient(object):
232
258
  result = self.score_modifier.modify(result)
233
259
  return result
234
260
 
261
+ async def apply_on_text_later(self, text_id,
262
+ modify_scores: bool = False) -> Result:
263
+ if not is_valid_id(self.model_id):
264
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
265
+
266
+ if not is_valid_id(text_id):
267
+ raise RuntimeError("Please use valid text_id. [try audio.id from list_texts()]")
268
+
269
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply_async")
270
+ result = self.retort.load(resp.json(), Result)
271
+ if modify_scores:
272
+ result = self.score_modifier.modify(result)
273
+ return result
274
+
235
275
  async def get_job_status(self, audio_id) -> JobStatus:
236
276
  if not is_valid_id(self.model_id):
237
277
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: most-client
3
- Version: 1.0.21
3
+ Version: 1.0.23
4
4
  Summary: Most AI API for https://the-most.ai
5
5
  Home-page: https://github.com/the-most-ai/most-client
6
6
  Author: George Kasparyants
@@ -0,0 +1,10 @@
1
+ most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
+ most/api.py,sha256=Fp9MeADwnjwf8_BYbleIKB0gFfsK3GNsNZDHRnqgOms,16256
3
+ most/async_api.py,sha256=7kFpsU6yCAeEjOroXL-t_m1RIOwLqmMyPq9tPhoUIjw,17243
4
+ most/score_calculation.py,sha256=1XU1LfIH5LSCwAbAaKkr-EjH5qOTXrJKOUvhCCawka4,1054
5
+ most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
6
+ most_client-1.0.23.dist-info/METADATA,sha256=pBQkXH2Ogl8Ot9SWv8gLnmB8r7j1t74eY3X6oCoC63M,1027
7
+ most_client-1.0.23.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
8
+ most_client-1.0.23.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
9
+ most_client-1.0.23.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
+ most_client-1.0.23.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
- most/api.py,sha256=XasEgTSE6KzBfCSZTDdAQ324DnTgN-pt_IToorR2Zlw,14338
3
- most/async_api.py,sha256=x-akTsTAthRMB80JgK2dkRD_HLWe2LrNGWEOOmCNLQY,15247
4
- most/score_calculation.py,sha256=1XU1LfIH5LSCwAbAaKkr-EjH5qOTXrJKOUvhCCawka4,1054
5
- most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
6
- most_client-1.0.21.dist-info/METADATA,sha256=tsv9K4_6N3JpgcwIn0ElcAGSANUqW_dwjiu-REIt6Ik,1027
7
- most_client-1.0.21.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
8
- most_client-1.0.21.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
9
- most_client-1.0.21.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
- most_client-1.0.21.dist-info/RECORD,,