most-client 1.0.2__py3-none-any.whl → 1.0.3__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/__init__.py CHANGED
@@ -1 +1,2 @@
1
1
  from .api import MostClient
2
+ from .async_api import AsyncMostClient
most/api.py CHANGED
@@ -2,7 +2,7 @@ from typing import List
2
2
  import json5
3
3
  import requests
4
4
  from adaptix import Retort
5
- from most.types import Audio, Result, Script
5
+ from most.types import Audio, Result, Script, JobStatus
6
6
  from pathlib import Path
7
7
 
8
8
 
@@ -143,8 +143,17 @@ class MostClient(object):
143
143
  resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply")
144
144
  return self.retort.load(resp.json(), Result)
145
145
 
146
- def apply_later(self, audio_id):
147
- raise NotImplementedError()
146
+ def apply_later(self, audio_id) -> Result:
147
+ if self.model_id is None:
148
+ raise RuntimeError("Please choose a model to apply. [try list_models()]")
149
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply_async")
150
+ return self.retort.load(resp.json(), Result)
151
+
152
+ def get_job_status(self, audio_id) -> JobStatus:
153
+ if self.model_id is None:
154
+ raise RuntimeError("Please choose a model to apply. [try list_models()]")
155
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply_status")
156
+ return self.retort.load(resp.json(), JobStatus)
148
157
 
149
158
  def fetch_results(self, audio_id) -> Result:
150
159
  if self.model_id is None:
most/async_api.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from typing import List
2
2
  import json5
3
3
  from adaptix import Retort
4
- from most.types import Audio, Result, Script
4
+ from most.types import Audio, Result, Script, JobStatus
5
5
  from pathlib import Path
6
6
  import httpx
7
7
 
@@ -152,7 +152,16 @@ class AsyncMostClient(object):
152
152
  return self.retort.load(resp.json(), Result)
153
153
 
154
154
  async def apply_later(self, audio_id):
155
- raise NotImplementedError()
155
+ if self.model_id is None:
156
+ raise RuntimeError("Please choose a model to apply. [try list_models()]")
157
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply_async")
158
+ return self.retort.load(resp.json(), Result)
159
+
160
+ async def get_job_status(self, audio_id) -> JobStatus:
161
+ if self.model_id is None:
162
+ raise RuntimeError("Please choose a model to apply. [try list_models()]")
163
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply_status")
164
+ return self.retort.load(resp.json(), JobStatus)
156
165
 
157
166
  async def fetch_results(self, audio_id) -> Result:
158
167
  if self.model_id is None:
@@ -173,4 +182,4 @@ class AsyncMostClient(object):
173
182
  return await self.apply(audio.id)
174
183
 
175
184
  def __repr__(self):
176
- return "<MostClient(model_id='%s')>" % (self.model_id, )
185
+ return "<AsyncMostClient(model_id='%s')>" % (self.model_id, )
most/types.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass
2
- from typing import Optional, List
2
+ from typing import Optional, List, Literal
3
3
 
4
4
 
5
5
  @dataclass
@@ -38,3 +38,8 @@ class Column:
38
38
  @dataclass
39
39
  class Script:
40
40
  columns: List[Column]
41
+
42
+
43
+ @dataclass
44
+ class JobStatus:
45
+ status: Literal["not_found", "pending", "completed", "error"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: most-client
3
- Version: 1.0.2
3
+ Version: 1.0.3
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,13 @@
1
+ most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
+ most/api.py,sha256=3B0G6qZUbAJtTKpQme0SdI2JnCsT-_fRDDWBZKKtmvA,7030
3
+ most/async_api.py,sha256=aepk9EXOv-tLVh8bNrACuTVkxGOtCZC5R3SBLi9qR90,7673
4
+ most/types.py,sha256=GP0i9ZtITz7k-_T5-SWMYevrRaN38vuNKRdxXEHgrFA,653
5
+ most/__pycache__/__init__.cpython-310.pyc,sha256=5RlgyJsgWSNkWEufVPFWDKxat0cEMCdwD8QFz5FvIj8,193
6
+ most/__pycache__/api.cpython-310.pyc,sha256=vAmUcfJHdL-59JuzcMpDfQedBaTk62nomDuzTt-thx0,5894
7
+ most/__pycache__/async_api.cpython-310.pyc,sha256=ng8wYkVziihVAMlv1ugFQQf-qFqP0NgAIfqKqE-K4k8,6615
8
+ most/__pycache__/types.cpython-310.pyc,sha256=OE7jIlp_0lo6XAwsnVnbsYsjjppGzTUcVo5ve6uHnQg,1492
9
+ most_client-1.0.3.dist-info/METADATA,sha256=msB8Kt-Cpr8u6FlMWtk0n2_jC3GwrHO4TXXEv1mbDgU,864
10
+ most_client-1.0.3.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
+ most_client-1.0.3.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
+ most_client-1.0.3.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
+ most_client-1.0.3.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- most/__init__.py,sha256=zfyI5dry-rsHP2Rr9YuPPo_fNFUtguZPAt-mbxDQ57I,28
2
- most/api.py,sha256=MRg52eg6Lf_sFwfTy2XYDHiD9VZSQ22BbvvkqQA1Fv0,6373
3
- most/async_api.py,sha256=ypdQ1P-aDblDlM6LbxNDjVjrkp-INJvg5an1n0vhi-E,7003
4
- most/types.py,sha256=7FgmaE7xHXggoU859BucqB13DA83CqmUPmBEuikNqE8,548
5
- most/__pycache__/__init__.cpython-310.pyc,sha256=5RlgyJsgWSNkWEufVPFWDKxat0cEMCdwD8QFz5FvIj8,193
6
- most/__pycache__/api.cpython-310.pyc,sha256=vAmUcfJHdL-59JuzcMpDfQedBaTk62nomDuzTt-thx0,5894
7
- most/__pycache__/async_api.cpython-310.pyc,sha256=ng8wYkVziihVAMlv1ugFQQf-qFqP0NgAIfqKqE-K4k8,6615
8
- most/__pycache__/types.cpython-310.pyc,sha256=OE7jIlp_0lo6XAwsnVnbsYsjjppGzTUcVo5ve6uHnQg,1492
9
- most_client-1.0.2.dist-info/METADATA,sha256=7gIy21ifYHR1jPNd-_rxkb-mDHK9pNRt18w7vwlxPto,864
10
- most_client-1.0.2.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
- most_client-1.0.2.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
- most_client-1.0.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
- most_client-1.0.2.dist-info/RECORD,,