most-client 1.0.20__py3-none-any.whl → 1.0.21__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 +4 -2
- most/async_api.py +4 -2
- most/score_calculation.py +15 -11
- {most_client-1.0.20.dist-info → most_client-1.0.21.dist-info}/METADATA +1 -1
- most_client-1.0.21.dist-info/RECORD +10 -0
- most_client-1.0.20.dist-info/RECORD +0 -10
- {most_client-1.0.20.dist-info → most_client-1.0.21.dist-info}/WHEEL +0 -0
- {most_client-1.0.20.dist-info → most_client-1.0.21.dist-info}/top_level.txt +0 -0
- {most_client-1.0.20.dist-info → most_client-1.0.21.dist-info}/zip-safe +0 -0
most/api.py
CHANGED
@@ -301,9 +301,11 @@ class MostClient(object):
|
|
301
301
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info")
|
302
302
|
return self.retort.load(resp.json(), StoredAudioData)
|
303
303
|
|
304
|
-
def __call__(self, audio_path: Path
|
304
|
+
def __call__(self, audio_path: Path,
|
305
|
+
modify_scores: bool = False) -> Result:
|
305
306
|
audio = self.upload_audio(audio_path)
|
306
|
-
return self.apply(audio.id
|
307
|
+
return self.apply(audio.id,
|
308
|
+
modify_scores=modify_scores)
|
307
309
|
|
308
310
|
def __repr__(self):
|
309
311
|
return "<MostClient(model_id='%s')>" % (self.model_id, )
|
most/async_api.py
CHANGED
@@ -306,9 +306,11 @@ class AsyncMostClient(object):
|
|
306
306
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/info")
|
307
307
|
return self.retort.load(resp.json(), StoredAudioData)
|
308
308
|
|
309
|
-
async def __call__(self, audio_path: Path
|
309
|
+
async def __call__(self, audio_path: Path,
|
310
|
+
modify_scores: bool = False) -> Result:
|
310
311
|
audio = await self.upload_audio(audio_path)
|
311
|
-
return await self.apply(audio.id
|
312
|
+
return await self.apply(audio.id,
|
313
|
+
modify_scores=modify_scores)
|
312
314
|
|
313
315
|
def __repr__(self):
|
314
316
|
return "<AsyncMostClient(model_id='%s')>" % (self.model_id, )
|
most/score_calculation.py
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
import dataclasses
|
2
1
|
from typing import Dict, Tuple, List, Optional
|
3
|
-
|
2
|
+
from dataclasses_json import dataclass_json, DataClassJsonMixin
|
3
|
+
from dataclasses import dataclass, replace
|
4
4
|
from .types import Result, ScriptScoreMapping
|
5
5
|
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
(sm.column, sm.subcolumn, sm.from_score): sm.to_score
|
12
|
-
for sm in score_mapping
|
13
|
-
}
|
7
|
+
@dataclass_json
|
8
|
+
@dataclass
|
9
|
+
class ScoreCalculation(DataClassJsonMixin):
|
10
|
+
score_mapping: List[ScriptScoreMapping]
|
14
11
|
|
15
12
|
def modify(self, result: Optional[Result]):
|
13
|
+
score_mapping = {
|
14
|
+
(sm.column, sm.subcolumn, sm.from_score): sm.to_score
|
15
|
+
for sm in self.score_mapping
|
16
|
+
}
|
16
17
|
if result is None:
|
17
18
|
return None
|
18
|
-
result =
|
19
|
+
result = replace(result)
|
19
20
|
for column_result in result.results:
|
20
21
|
for subcolumn_result in column_result.subcolumns:
|
21
|
-
subcolumn_result.score =
|
22
|
+
subcolumn_result.score = score_mapping.get((column_result.name,
|
23
|
+
subcolumn_result.name,
|
24
|
+
subcolumn_result.score),
|
25
|
+
subcolumn_result.score)
|
22
26
|
|
23
27
|
return result
|
@@ -0,0 +1,10 @@
|
|
1
|
+
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
+
most/api.py,sha256=XasEgTSE6KzBfCSZTDdAQ324DnTgN-pt_IToorR2Zlw,14338
|
3
|
+
most/async_api.py,sha256=x-akTsTAthRMB80JgK2dkRD_HLWe2LrNGWEOOmCNLQY,15247
|
4
|
+
most/score_calculation.py,sha256=1XU1LfIH5LSCwAbAaKkr-EjH5qOTXrJKOUvhCCawka4,1054
|
5
|
+
most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
|
6
|
+
most_client-1.0.21.dist-info/METADATA,sha256=tsv9K4_6N3JpgcwIn0ElcAGSANUqW_dwjiu-REIt6Ik,1027
|
7
|
+
most_client-1.0.21.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
8
|
+
most_client-1.0.21.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
9
|
+
most_client-1.0.21.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
10
|
+
most_client-1.0.21.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
-
most/api.py,sha256=8OzUI_Af0Ct1hx0fopTf3bDGPU8gxWuuMP1VvxpAFiU,14227
|
3
|
-
most/async_api.py,sha256=40orcOYLvFJTTlfYGIyyUXvvsfKYchDblRXzHNNGNPs,15124
|
4
|
-
most/score_calculation.py,sha256=oGBEIzefKiqCS77BOX7-jHTvpLRkH0Vhnqu1IVDmsdM,800
|
5
|
-
most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
|
6
|
-
most_client-1.0.20.dist-info/METADATA,sha256=XTRaD7okJvsBLOJWUKlRTPaRhM423CFOkQ6wuT2_1XI,1027
|
7
|
-
most_client-1.0.20.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
8
|
-
most_client-1.0.20.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
9
|
-
most_client-1.0.20.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
10
|
-
most_client-1.0.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|