most-client 1.0.7__py3-none-any.whl → 1.0.9__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 +15 -2
- most/async_api.py +14 -1
- most/types.py +6 -0
- {most_client-1.0.7.dist-info → most_client-1.0.9.dist-info}/METADATA +10 -4
- most_client-1.0.9.dist-info/RECORD +9 -0
- {most_client-1.0.7.dist-info → most_client-1.0.9.dist-info}/WHEEL +1 -1
- most/__pycache__/__init__.cpython-310.pyc +0 -0
- most/__pycache__/api.cpython-310.pyc +0 -0
- most/__pycache__/async_api.cpython-310.pyc +0 -0
- most/__pycache__/types.cpython-310.pyc +0 -0
- most_client-1.0.7.dist-info/RECORD +0 -13
- {most_client-1.0.7.dist-info → most_client-1.0.9.dist-info}/top_level.txt +0 -0
- {most_client-1.0.7.dist-info → most_client-1.0.9.dist-info}/zip-safe +0 -0
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, JobStatus
|
5
|
+
from most.types import Audio, Result, Script, JobStatus, Text
|
6
6
|
from pathlib import Path
|
7
7
|
|
8
8
|
|
@@ -120,6 +120,11 @@ class MostClient(object):
|
|
120
120
|
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
|
121
121
|
return resp
|
122
122
|
|
123
|
+
def upload_text(self, text: str) -> Text:
|
124
|
+
resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_text",
|
125
|
+
files={"text": text})
|
126
|
+
return self.retort.load(resp.json(), Text)
|
127
|
+
|
123
128
|
def upload_audio(self, audio_path) -> Audio:
|
124
129
|
with open(audio_path, 'rb') as f:
|
125
130
|
resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
@@ -174,13 +179,21 @@ class MostClient(object):
|
|
174
179
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/results")
|
175
180
|
return self.retort.load(resp.json(), Result)
|
176
181
|
|
177
|
-
def fetch_text(self, audio_id) -> Result:
|
182
|
+
def fetch_text(self, audio_id: str) -> Result:
|
178
183
|
if self.model_id is None:
|
179
184
|
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
180
185
|
|
181
186
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
182
187
|
return self.retort.load(resp.json(), Result)
|
183
188
|
|
189
|
+
def export(self, audio_ids: List[str]) -> str:
|
190
|
+
if self.model_id is None:
|
191
|
+
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
192
|
+
|
193
|
+
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
194
|
+
params={'audio_ids': ','.join(audio_ids)})
|
195
|
+
return resp.url
|
196
|
+
|
184
197
|
def __call__(self, audio_path: Path):
|
185
198
|
audio = self.upload_audio(audio_path)
|
186
199
|
return self.apply(audio.id)
|
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, JobStatus
|
4
|
+
from most.types import Audio, Result, Script, JobStatus, Text
|
5
5
|
from pathlib import Path
|
6
6
|
import httpx
|
7
7
|
|
@@ -133,6 +133,11 @@ class AsyncMostClient(object):
|
|
133
133
|
files={"audio_file": f})
|
134
134
|
return self.retort.load(resp.json(), Audio)
|
135
135
|
|
136
|
+
async def upload_text(self, text: str) -> Text:
|
137
|
+
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_text",
|
138
|
+
json={"text": text})
|
139
|
+
return self.retort.load(resp.json(), Text)
|
140
|
+
|
136
141
|
async def upload_audio_url(self, audio_url) -> Audio:
|
137
142
|
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_url",
|
138
143
|
json={"audio_url": audio_url})
|
@@ -188,6 +193,14 @@ class AsyncMostClient(object):
|
|
188
193
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
189
194
|
return self.retort.load(resp.json(), Result)
|
190
195
|
|
196
|
+
async def export(self, audio_ids: List[str]) -> str:
|
197
|
+
if self.model_id is None:
|
198
|
+
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
199
|
+
|
200
|
+
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
201
|
+
params={'audio_ids': ','.join(audio_ids)})
|
202
|
+
return resp.next_request.url
|
203
|
+
|
191
204
|
async def __call__(self, audio_path: Path):
|
192
205
|
audio = await self.upload_audio(audio_path)
|
193
206
|
return await self.apply(audio.id)
|
most/types.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: most-client
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.9
|
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
|
@@ -16,7 +16,7 @@ Requires-Dist: requests
|
|
16
16
|
Requires-Dist: wheel
|
17
17
|
Requires-Dist: adaptix
|
18
18
|
Requires-Dist: json5
|
19
|
-
Requires-Dist:
|
19
|
+
Requires-Dist: dataclasses_json
|
20
20
|
Requires-Dist: black
|
21
21
|
Requires-Dist: coverage
|
22
22
|
Requires-Dist: flake8
|
@@ -26,4 +26,10 @@ Requires-Dist: pytest
|
|
26
26
|
Requires-Dist: tox
|
27
27
|
Requires-Dist: twine
|
28
28
|
Requires-Dist: httpx
|
29
|
-
|
29
|
+
Dynamic: author
|
30
|
+
Dynamic: author-email
|
31
|
+
Dynamic: classifier
|
32
|
+
Dynamic: home-page
|
33
|
+
Dynamic: requires-dist
|
34
|
+
Dynamic: requires-python
|
35
|
+
Dynamic: summary
|
@@ -0,0 +1,9 @@
|
|
1
|
+
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
+
most/api.py,sha256=0SP29wq9RjVJ7D5ziX0FtG8uEAU-CBOE06cqxqNT-oc,8407
|
3
|
+
most/async_api.py,sha256=M8WhCagCHTooH77znMsHG98jYWJ2aPgxFx_PeKXBC-0,9016
|
4
|
+
most/types.py,sha256=PZ-_yed7MnIRdygaI6aK9U6BFjWAof7JK2AgSlokXe8,1450
|
5
|
+
most_client-1.0.9.dist-info/METADATA,sha256=0SAcuVnUN53VhAViD3nlUzZMHLaFL8vspXyM-mW_xBY,1005
|
6
|
+
most_client-1.0.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
+
most_client-1.0.9.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
8
|
+
most_client-1.0.9.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
9
|
+
most_client-1.0.9.dist-info/RECORD,,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
-
most/api.py,sha256=-vs2oUAxS4D7r6pT3gLDLCFKGFq8KYMHK8J4OZiT_lo,7781
|
3
|
-
most/async_api.py,sha256=8ygKjUzBXNyO3EX4WiPwVCMlfwhPJLIcCtlR6DaYABk,8347
|
4
|
-
most/types.py,sha256=xtKsXbO40AgLIgTf-YndJnT2yfTlCl-p-j3M1CMBB8k,1377
|
5
|
-
most/__pycache__/__init__.cpython-310.pyc,sha256=uRCbA8tXEFLxmAlpQAF8Vdh8AZbpR52RSrGOfKRxpAQ,229
|
6
|
-
most/__pycache__/api.cpython-310.pyc,sha256=YuMpKt9DwpvUgXH2qPKMVbJxwgkTLrp9wso73MA3jkM,6582
|
7
|
-
most/__pycache__/async_api.cpython-310.pyc,sha256=d4RQJ-yhe9rbMjjU_7IyeK0lRB7WalIdXpXRxz-Db4A,7328
|
8
|
-
most/__pycache__/types.cpython-310.pyc,sha256=B3tij9LD4YJAXWiC3VHtnkVzpw5QRirrHpDMD-vekII,1861
|
9
|
-
most_client-1.0.7.dist-info/METADATA,sha256=998XxFnZjTTpsyjTvJiQ9mwwkWCLDjf8V9o6N_yOJXQ,864
|
10
|
-
most_client-1.0.7.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
11
|
-
most_client-1.0.7.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
12
|
-
most_client-1.0.7.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
13
|
-
most_client-1.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|