most-client 1.0.8__py3-none-any.whl → 1.0.10__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
@@ -1,8 +1,8 @@
1
- from typing import List
1
+ from typing import List, Dict
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, StoredAudioData
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",
@@ -189,6 +194,19 @@ class MostClient(object):
189
194
  params={'audio_ids': ','.join(audio_ids)})
190
195
  return resp.url
191
196
 
197
+ def store_info(self,
198
+ audio_id: str,
199
+ data: Dict[str, str]):
200
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info",
201
+ json={
202
+ "data": data,
203
+ })
204
+ return self.retort.load(resp.json(), StoredAudioData)
205
+
206
+ def fetch_info(self, audio_id: str) -> Dict[str, str]:
207
+ resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info")
208
+ return self.retort.load(resp.json(), StoredAudioData)
209
+
192
210
  def __call__(self, audio_path: Path):
193
211
  audio = self.upload_audio(audio_path)
194
212
  return self.apply(audio.id)
most/async_api.py CHANGED
@@ -1,7 +1,7 @@
1
- from typing import List
1
+ from typing import List, Dict
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, StoredAudioData
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})
@@ -196,6 +201,19 @@ class AsyncMostClient(object):
196
201
  params={'audio_ids': ','.join(audio_ids)})
197
202
  return resp.next_request.url
198
203
 
204
+ async def store_info(self,
205
+ audio_id: str,
206
+ data: Dict[str, str]):
207
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info",
208
+ json={
209
+ "data": data,
210
+ })
211
+ return self.retort.load(resp.json(), StoredAudioData)
212
+
213
+ async def fetch_info(self, audio_id: str) -> Dict[str, str]:
214
+ resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info")
215
+ return self.retort.load(resp.json(), StoredAudioData)
216
+
199
217
  async def __call__(self, audio_path: Path):
200
218
  audio = await self.upload_audio(audio_path)
201
219
  return await self.apply(audio.id)
most/types.py CHANGED
@@ -1,6 +1,13 @@
1
1
  from dataclasses import dataclass
2
2
  from dataclasses_json import dataclass_json, DataClassJsonMixin
3
- from typing import Optional, List, Literal
3
+ from typing import Optional, List, Literal, Dict
4
+
5
+
6
+ @dataclass_json
7
+ @dataclass
8
+ class StoredAudioData(DataClassJsonMixin):
9
+ id: str
10
+ data: Dict[str, str]
4
11
 
5
12
 
6
13
  @dataclass_json
@@ -10,6 +17,12 @@ class Audio(DataClassJsonMixin):
10
17
  url: str
11
18
 
12
19
 
20
+ @dataclass_json
21
+ @dataclass
22
+ class Text(DataClassJsonMixin):
23
+ id: str
24
+
25
+
13
26
  @dataclass_json
14
27
  @dataclass
15
28
  class SubcolumnResult(DataClassJsonMixin):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: most-client
3
- Version: 1.0.8
3
+ Version: 1.0.10
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
@@ -26,3 +26,10 @@ Requires-Dist: pytest
26
26
  Requires-Dist: tox
27
27
  Requires-Dist: twine
28
28
  Requires-Dist: httpx
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=tD6GkStvShdGTnjCLD34OSXLTV9mpJSQCKqo0UGsE60,9028
3
+ most/async_api.py,sha256=ixUxEttK5ibcRdWV9DghU9ixQcJWxXqdnkFEYsc6crA,9691
4
+ most/types.py,sha256=-GF8GBe0ojaAqyFl0yju030cZuUDe_6YU_5Q_5FT7UI,1565
5
+ most_client-1.0.10.dist-info/METADATA,sha256=YF8cjUF9bVgJhPg1xf-a3GNx7VPvjM9vkPgsgB5dYJk,1006
6
+ most_client-1.0.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ most_client-1.0.10.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
8
+ most_client-1.0.10.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ most_client-1.0.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
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,,