most-client 1.0.6__py3-none-any.whl → 1.0.8__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 +13 -2
- most/async_api.py +12 -4
- {most_client-1.0.6.dist-info → most_client-1.0.8.dist-info}/METADATA +2 -3
- most_client-1.0.8.dist-info/RECORD +9 -0
- {most_client-1.0.6.dist-info → most_client-1.0.8.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.6.dist-info/RECORD +0 -13
- {most_client-1.0.6.dist-info → most_client-1.0.8.dist-info}/top_level.txt +0 -0
- {most_client-1.0.6.dist-info → most_client-1.0.8.dist-info}/zip-safe +0 -0
most/api.py
CHANGED
@@ -72,7 +72,8 @@ class MostClient(object):
|
|
72
72
|
def refresh_access_token(self):
|
73
73
|
resp = self.session.post("https://api.the-most.ai/api/external/access_token",
|
74
74
|
json={"client_id": self.client_id,
|
75
|
-
"client_secret": self.client_secret}
|
75
|
+
"client_secret": self.client_secret},
|
76
|
+
timeout=None)
|
76
77
|
access_token = resp.json()
|
77
78
|
self.access_token = access_token
|
78
79
|
|
@@ -83,6 +84,7 @@ class MostClient(object):
|
|
83
84
|
headers.update({"Authorization": "Bearer %s" % self.access_token})
|
84
85
|
resp = self.session.get(url,
|
85
86
|
headers=headers,
|
87
|
+
timeout=None,
|
86
88
|
**kwargs)
|
87
89
|
if resp.status_code == 401:
|
88
90
|
self.refresh_access_token()
|
@@ -105,6 +107,7 @@ class MostClient(object):
|
|
105
107
|
data=data,
|
106
108
|
json=json,
|
107
109
|
headers=headers,
|
110
|
+
timeout=None,
|
108
111
|
**kwargs)
|
109
112
|
if resp.status_code == 401:
|
110
113
|
self.refresh_access_token()
|
@@ -171,13 +174,21 @@ class MostClient(object):
|
|
171
174
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/results")
|
172
175
|
return self.retort.load(resp.json(), Result)
|
173
176
|
|
174
|
-
def fetch_text(self, audio_id) -> Result:
|
177
|
+
def fetch_text(self, audio_id: str) -> Result:
|
175
178
|
if self.model_id is None:
|
176
179
|
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
177
180
|
|
178
181
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
179
182
|
return self.retort.load(resp.json(), Result)
|
180
183
|
|
184
|
+
def export(self, audio_ids: List[str]) -> str:
|
185
|
+
if self.model_id is None:
|
186
|
+
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
187
|
+
|
188
|
+
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
189
|
+
params={'audio_ids': ','.join(audio_ids)})
|
190
|
+
return resp.url
|
191
|
+
|
181
192
|
def __call__(self, audio_path: Path):
|
182
193
|
audio = self.upload_audio(audio_path)
|
183
194
|
return self.apply(audio.id)
|
most/async_api.py
CHANGED
@@ -89,6 +89,7 @@ class AsyncMostClient(object):
|
|
89
89
|
headers.update({"Authorization": "Bearer %s" % self.access_token})
|
90
90
|
resp = await self.session.get(url,
|
91
91
|
headers=headers,
|
92
|
+
timeout=None,
|
92
93
|
**kwargs)
|
93
94
|
if resp.status_code == 401:
|
94
95
|
await self.refresh_access_token()
|
@@ -112,6 +113,7 @@ class AsyncMostClient(object):
|
|
112
113
|
data=data,
|
113
114
|
json=json,
|
114
115
|
headers=headers,
|
116
|
+
timeout=None,
|
115
117
|
**kwargs)
|
116
118
|
if resp.status_code == 401:
|
117
119
|
await self.refresh_access_token()
|
@@ -128,8 +130,7 @@ class AsyncMostClient(object):
|
|
128
130
|
async def upload_audio(self, audio_path) -> Audio:
|
129
131
|
with open(audio_path, mode='rb') as f:
|
130
132
|
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
131
|
-
files={"audio_file": f}
|
132
|
-
timeout=None)
|
133
|
+
files={"audio_file": f})
|
133
134
|
return self.retort.load(resp.json(), Audio)
|
134
135
|
|
135
136
|
async def upload_audio_url(self, audio_url) -> Audio:
|
@@ -158,8 +159,7 @@ class AsyncMostClient(object):
|
|
158
159
|
async def apply(self, audio_id) -> Result:
|
159
160
|
if self.model_id is None:
|
160
161
|
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
161
|
-
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply"
|
162
|
-
timeout=None)
|
162
|
+
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/apply")
|
163
163
|
return self.retort.load(resp.json(), Result)
|
164
164
|
|
165
165
|
async def apply_later(self, audio_id):
|
@@ -188,6 +188,14 @@ class AsyncMostClient(object):
|
|
188
188
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
189
189
|
return self.retort.load(resp.json(), Result)
|
190
190
|
|
191
|
+
async def export(self, audio_ids: List[str]) -> str:
|
192
|
+
if self.model_id is None:
|
193
|
+
raise RuntimeError("Please choose a model to apply. [try list_models()]")
|
194
|
+
|
195
|
+
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/export",
|
196
|
+
params={'audio_ids': ','.join(audio_ids)})
|
197
|
+
return resp.next_request.url
|
198
|
+
|
191
199
|
async def __call__(self, audio_path: Path):
|
192
200
|
audio = await self.upload_audio(audio_path)
|
193
201
|
return await self.apply(audio.id)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: most-client
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.8
|
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,3 @@ Requires-Dist: pytest
|
|
26
26
|
Requires-Dist: tox
|
27
27
|
Requires-Dist: twine
|
28
28
|
Requires-Dist: httpx
|
29
|
-
|
@@ -0,0 +1,9 @@
|
|
1
|
+
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
+
most/api.py,sha256=ZM5wLJGfMoL8UYOxvZU4EZYmpeqmP5BKz1zEQhxeAS4,8161
|
3
|
+
most/async_api.py,sha256=QD2wGay57S7afHXqhhC9Pq2P0vIC8tJ6vrIz8xbvfjM,8753
|
4
|
+
most/types.py,sha256=xtKsXbO40AgLIgTf-YndJnT2yfTlCl-p-j3M1CMBB8k,1377
|
5
|
+
most_client-1.0.8.dist-info/METADATA,sha256=0_NfZJ8wCe9mFm7HXtkxFBNP0rR__M_oSCiHdzCtDBE,863
|
6
|
+
most_client-1.0.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
7
|
+
most_client-1.0.8.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
8
|
+
most_client-1.0.8.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
9
|
+
most_client-1.0.8.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=35SmN9BhZRUQZMH400MYh0LAHgYK8d_25at5BaBihIw,7641
|
3
|
-
most/async_api.py,sha256=QTQ2RdLeI2GzB6EvlrRnpoqs9XBOR64drVTpulvGrFI,8336
|
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.6.dist-info/METADATA,sha256=SLqGtvyjFNtkSOw3o7RNVS9Ur0fy5HRzz_8gGN_85Bs,864
|
10
|
-
most_client-1.0.6.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
11
|
-
most_client-1.0.6.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
12
|
-
most_client-1.0.6.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
13
|
-
most_client-1.0.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|