sciveo 0.1.18__tar.gz → 0.1.19__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.
- {sciveo-0.1.18 → sciveo-0.1.19}/PKG-INFO +1 -1
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/random.py +11 -0
- sciveo-0.1.19/sciveo/common/tools/remote.py +73 -0
- sciveo-0.1.19/sciveo/version.py +2 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/PKG-INFO +1 -1
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/SOURCES.txt +1 -0
- sciveo-0.1.18/sciveo/version.py +0 -2
- {sciveo-0.1.18 → sciveo-0.1.19}/README.md +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/base.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/upload.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/cli.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/configuration.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/model.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/optimizers.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/sampling.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/compress.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/configuration.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/crypto.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/daemon.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/formating.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/hardware.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/logger.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/synchronized.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/timers.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/dataset.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/experiment.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/project.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/runner.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/monitor.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/start.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/__init__.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/camera.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/tools.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/tunnel.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/dependency_links.txt +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/entry_points.txt +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/requires.txt +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/top_level.txt +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/setup.cfg +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/setup.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_compress.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_configuration.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_crypto.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_monitoring.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_runner.py +0 -0
- {sciveo-0.1.18 → sciveo-0.1.19}/test/test_sampling.py +0 -0
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Pavlin Georgiev, Softel Labs
|
|
3
|
+
#
|
|
4
|
+
# This is a proprietary file and may not be copied,
|
|
5
|
+
# distributed, or modified without express permission
|
|
6
|
+
# from the owner. For licensing inquiries, please
|
|
7
|
+
# contact pavlin@softel.bg.
|
|
8
|
+
#
|
|
9
|
+
# 2023
|
|
10
|
+
#
|
|
11
|
+
|
|
1
12
|
import random
|
|
2
13
|
import string
|
|
3
14
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Pavlin Georgiev, Softel Labs
|
|
3
|
+
#
|
|
4
|
+
# This is a proprietary file and may not be copied,
|
|
5
|
+
# distributed, or modified without express permission
|
|
6
|
+
# from the owner. For licensing inquiries, please
|
|
7
|
+
# contact pavlin@softel.bg.
|
|
8
|
+
#
|
|
9
|
+
# 2024
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import time
|
|
14
|
+
import cv2
|
|
15
|
+
import base64
|
|
16
|
+
import requests
|
|
17
|
+
|
|
18
|
+
from sciveo.common.tools.logger import *
|
|
19
|
+
from sciveo.common.tools.configuration import GlobalConfiguration
|
|
20
|
+
from sciveo.common.tools.compress import CompressJsonData
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class PredictorRemoteClient:
|
|
24
|
+
def __init__(self, url="http://localhost:8901", verify=True, auth_token=None, api_prefix=None):
|
|
25
|
+
debug(type(self).__name__, "init url", url, verify)
|
|
26
|
+
config = GlobalConfiguration.get()
|
|
27
|
+
if auth_token is None:
|
|
28
|
+
auth_token = config["api_auth_token"]
|
|
29
|
+
if api_prefix is None:
|
|
30
|
+
api_prefix = config["api_prefix"]
|
|
31
|
+
self.auth_token = auth_token
|
|
32
|
+
self.api_prefix = api_prefix
|
|
33
|
+
self.url = f"{url}/{self.api_prefix}/predict"
|
|
34
|
+
self.verify = verify
|
|
35
|
+
requests.packages.urllib3.disable_warnings()
|
|
36
|
+
|
|
37
|
+
def predict(self, params):
|
|
38
|
+
try:
|
|
39
|
+
debug(type(self).__name__, "predict", params)
|
|
40
|
+
headers = {"Authorization": f"Bearer {self.auth_token}"}
|
|
41
|
+
response = requests.post(self.url, json=params, headers=headers, verify=self.verify)
|
|
42
|
+
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
data = response.json()
|
|
45
|
+
|
|
46
|
+
if params.get("compressed", 0) > 0 and params["predictor"] in data:
|
|
47
|
+
predicted = data[params["predictor"]]
|
|
48
|
+
predicted = CompressJsonData().decompress(predicted)
|
|
49
|
+
data[params["predictor"]] = predicted
|
|
50
|
+
else:
|
|
51
|
+
error(type(self).__name__, f"Request [{self.url}] failed with status code {response.status_code}")
|
|
52
|
+
data = {"error": response.status_code}
|
|
53
|
+
except Exception as e:
|
|
54
|
+
exception(type(self).__name__, "predict", e)
|
|
55
|
+
data = {"error": str(e)}
|
|
56
|
+
return data
|
|
57
|
+
|
|
58
|
+
def image_encoded(self, image=None, resize_to=(256, 256), local_path=None):
|
|
59
|
+
if local_path is not None:
|
|
60
|
+
image = cv2.imread(local_path)
|
|
61
|
+
if resize_to is not None:
|
|
62
|
+
image = cv2.resize(image, resize_to)
|
|
63
|
+
buffer = cv2.imencode('.jpg', image)[1].tobytes()
|
|
64
|
+
return base64.b64encode(buffer).decode('utf-8')
|
|
65
|
+
|
|
66
|
+
def predict_image_embedding(self, image=None, resize_to=(256, 256), local_path=None):
|
|
67
|
+
image_base64 = self.image_encoded(image=image, resize_to=resize_to, local_path=local_path)
|
|
68
|
+
params = {
|
|
69
|
+
'predictor': 'ImageEmbedding', 'compressed': 1,
|
|
70
|
+
'X': [image_base64]
|
|
71
|
+
}
|
|
72
|
+
r = self.predict(params=params)
|
|
73
|
+
return r[params["predictor"]][0]
|
|
@@ -26,6 +26,7 @@ sciveo/common/tools/formating.py
|
|
|
26
26
|
sciveo/common/tools/hardware.py
|
|
27
27
|
sciveo/common/tools/logger.py
|
|
28
28
|
sciveo/common/tools/random.py
|
|
29
|
+
sciveo/common/tools/remote.py
|
|
29
30
|
sciveo/common/tools/synchronized.py
|
|
30
31
|
sciveo/common/tools/timers.py
|
|
31
32
|
sciveo/content/__init__.py
|
sciveo-0.1.18/sciveo/version.py
DELETED
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|