most-client 1.0.21__tar.gz → 1.0.22__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: most-client
3
- Version: 1.0.21
3
+ Version: 1.0.22
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
@@ -173,6 +173,13 @@ class MostClient(object):
173
173
  audio_list = resp.json()
174
174
  return self.retort.load(audio_list, List[Audio])
175
175
 
176
+ def list_texts(self,
177
+ offset: int = 0,
178
+ limit: int = 10) -> List[Text]:
179
+ resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/list_texts?offset={offset}&limit={limit}")
180
+ texts_list = resp.json()
181
+ return self.retort.load(texts_list, List[Text])
182
+
176
183
  def get_model_script(self) -> Script:
177
184
  if not is_valid_id(self.model_id):
178
185
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -209,6 +216,20 @@ class MostClient(object):
209
216
  result = self.score_modifier.modify(result)
210
217
  return result
211
218
 
219
+ def apply_on_text(self, text_id,
220
+ modify_scores: bool = False) -> Result:
221
+ if not is_valid_id(self.model_id):
222
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
223
+
224
+ if not is_valid_id(text_id):
225
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
226
+
227
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply")
228
+ result = self.retort.load(resp.json(), Result)
229
+ if modify_scores:
230
+ result = self.score_modifier.modify(result)
231
+ return result
232
+
212
233
  def apply_later(self, audio_id,
213
234
  modify_scores: bool = False) -> Result:
214
235
  if not is_valid_id(self.model_id):
@@ -223,6 +244,20 @@ class MostClient(object):
223
244
  result = self.score_modifier.modify(result)
224
245
  return result
225
246
 
247
+ def apply_on_text_later(self, text_id,
248
+ modify_scores: bool = False) -> Result:
249
+ if not is_valid_id(self.model_id):
250
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
251
+
252
+ if not is_valid_id(text_id):
253
+ raise RuntimeError("Please use valid text_id. [try audio.id from list_texts()]")
254
+
255
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply_async")
256
+ result = self.retort.load(resp.json(), Result)
257
+ if modify_scores:
258
+ result = self.score_modifier.modify(result)
259
+ return result
260
+
226
261
  def get_job_status(self, audio_id) -> JobStatus:
227
262
  if not is_valid_id(self.model_id):
228
263
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -182,6 +182,13 @@ class AsyncMostClient(object):
182
182
  audio_list = resp.json()
183
183
  return self.retort.load(audio_list, List[Audio])
184
184
 
185
+ async def list_texts(self,
186
+ offset: int = 0,
187
+ limit: int = 10) -> List[Text]:
188
+ resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/list_texts?offset={offset}&limit={limit}")
189
+ texts_list = resp.json()
190
+ return self.retort.load(texts_list, List[Text])
191
+
185
192
  async def get_model_script(self) -> Script:
186
193
  if not is_valid_id(self.model_id):
187
194
  raise RuntimeError("Please choose valid model to apply. [try list_models()]")
@@ -218,6 +225,20 @@ class AsyncMostClient(object):
218
225
  result = self.score_modifier.modify(result)
219
226
  return result
220
227
 
228
+ async def apply_on_text(self, text_id,
229
+ modify_scores: bool = False) -> Result:
230
+ if not is_valid_id(self.model_id):
231
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
232
+
233
+ if not is_valid_id(text_id):
234
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
235
+
236
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply")
237
+ result = self.retort.load(resp.json(), Result)
238
+ if modify_scores:
239
+ result = self.score_modifier.modify(result)
240
+ return result
241
+
221
242
  async def apply_later(self, audio_id,
222
243
  modify_scores: bool = False) -> Result:
223
244
  if not is_valid_id(self.model_id):
@@ -232,6 +253,20 @@ class AsyncMostClient(object):
232
253
  result = self.score_modifier.modify(result)
233
254
  return result
234
255
 
256
+ async def apply_on_text_later(self, text_id,
257
+ modify_scores: bool = False) -> Result:
258
+ if not is_valid_id(self.model_id):
259
+ raise RuntimeError("Please choose valid model to apply. [try list_models()]")
260
+
261
+ if not is_valid_id(text_id):
262
+ raise RuntimeError("Please use valid text_id. [try audio.id from list_texts()]")
263
+
264
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/text/{text_id}/model/{self.model_id}/apply_async")
265
+ result = self.retort.load(resp.json(), Result)
266
+ if modify_scores:
267
+ result = self.score_modifier.modify(result)
268
+ return result
269
+
235
270
  async def get_job_status(self, audio_id) -> JobStatus:
236
271
  if not is_valid_id(self.model_id):
237
272
  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.22
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
@@ -8,7 +8,7 @@ with open('requirements.txt', 'r') as f:
8
8
 
9
9
  setup(
10
10
  name='most-client',
11
- version='1.0.21',
11
+ version='1.0.22',
12
12
  python_requires=f'>=3.6',
13
13
  description='Most AI API for https://the-most.ai',
14
14
  url='https://github.com/the-most-ai/most-client',
File without changes
File without changes
File without changes
File without changes