most-client 1.0.16__tar.gz → 1.0.17__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.
- {most_client-1.0.16/most_client.egg-info → most_client-1.0.17}/PKG-INFO +1 -1
- {most_client-1.0.16 → most_client-1.0.17}/most/api.py +7 -3
- {most_client-1.0.16 → most_client-1.0.17}/most/async_api.py +7 -3
- {most_client-1.0.16 → most_client-1.0.17/most_client.egg-info}/PKG-INFO +1 -1
- {most_client-1.0.16 → most_client-1.0.17}/setup.py +1 -1
- {most_client-1.0.16 → most_client-1.0.17}/MANIFEST.in +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/README.md +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most/__init__.py +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most/types.py +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most_client.egg-info/SOURCES.txt +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most_client.egg-info/dependency_links.txt +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most_client.egg-info/requires.txt +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most_client.egg-info/top_level.txt +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/most_client.egg-info/zip-safe +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/requirements.txt +0 -0
- {most_client-1.0.16 → most_client-1.0.17}/setup.cfg +0 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
import io
|
2
2
|
import os
|
3
|
+
import uuid
|
3
4
|
from pathlib import Path
|
4
|
-
from typing import Dict, List
|
5
|
+
from typing import Dict, List, Optional
|
5
6
|
|
6
7
|
import json5
|
7
8
|
import requests
|
@@ -145,12 +146,15 @@ class MostClient(object):
|
|
145
146
|
files={"audio_file": f})
|
146
147
|
return self.retort.load(resp.json(), Audio)
|
147
148
|
|
148
|
-
def upload_audio_segment(self, audio: AudioSegment
|
149
|
+
def upload_audio_segment(self, audio: AudioSegment,
|
150
|
+
audio_name: Optional[str] = None) -> Audio:
|
149
151
|
f = io.BytesIO()
|
150
152
|
audio.export(f, format="mp3")
|
151
153
|
f.seek(0)
|
154
|
+
if audio_name is None:
|
155
|
+
audio_name = uuid.uuid4().hex + ".mp3"
|
152
156
|
resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
153
|
-
files={"audio_file": f})
|
157
|
+
files={"audio_file": (audio_name, f, 'audio/mp3')})
|
154
158
|
return self.retort.load(resp.json(), Audio)
|
155
159
|
|
156
160
|
def upload_audio_url(self, audio_url) -> Audio:
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import io
|
2
2
|
import os
|
3
|
+
import uuid
|
3
4
|
from pathlib import Path
|
4
|
-
from typing import Dict, List
|
5
|
+
from typing import Dict, List, Optional
|
5
6
|
|
6
7
|
import httpx
|
7
8
|
import json5
|
@@ -149,12 +150,15 @@ class AsyncMostClient(object):
|
|
149
150
|
files={"audio_file": f})
|
150
151
|
return self.retort.load(resp.json(), Audio)
|
151
152
|
|
152
|
-
async def upload_audio_segment(self, audio: AudioSegment
|
153
|
+
async def upload_audio_segment(self, audio: AudioSegment,
|
154
|
+
audio_name: Optional[str] = None) -> Audio:
|
153
155
|
f = io.BytesIO()
|
154
156
|
audio.export(f, format="mp3")
|
155
157
|
f.seek(0)
|
158
|
+
if audio_name is None:
|
159
|
+
audio_name = uuid.uuid4().hex + ".mp3"
|
156
160
|
resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload",
|
157
|
-
files={"audio_file": f})
|
161
|
+
files={"audio_file": (audio_name, f, 'audio/mp3')})
|
158
162
|
return self.retort.load(resp.json(), Audio)
|
159
163
|
|
160
164
|
async def upload_text(self, text: str) -> Text:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|