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.
Files changed (52) hide show
  1. {sciveo-0.1.18 → sciveo-0.1.19}/PKG-INFO +1 -1
  2. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/random.py +11 -0
  3. sciveo-0.1.19/sciveo/common/tools/remote.py +73 -0
  4. sciveo-0.1.19/sciveo/version.py +2 -0
  5. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/PKG-INFO +1 -1
  6. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/SOURCES.txt +1 -0
  7. sciveo-0.1.18/sciveo/version.py +0 -2
  8. {sciveo-0.1.18 → sciveo-0.1.19}/README.md +0 -0
  9. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/__init__.py +0 -0
  10. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/__init__.py +0 -0
  11. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/base.py +0 -0
  12. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/api/upload.py +0 -0
  13. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/cli.py +0 -0
  14. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/__init__.py +0 -0
  15. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/configuration.py +0 -0
  16. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/model.py +0 -0
  17. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/optimizers.py +0 -0
  18. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/sampling.py +0 -0
  19. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/__init__.py +0 -0
  20. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/compress.py +0 -0
  21. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/configuration.py +0 -0
  22. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/crypto.py +0 -0
  23. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/daemon.py +0 -0
  24. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/formating.py +0 -0
  25. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/hardware.py +0 -0
  26. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/logger.py +0 -0
  27. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/synchronized.py +0 -0
  28. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/common/tools/timers.py +0 -0
  29. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/__init__.py +0 -0
  30. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/dataset.py +0 -0
  31. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/experiment.py +0 -0
  32. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/project.py +0 -0
  33. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/content/runner.py +0 -0
  34. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/__init__.py +0 -0
  35. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/monitor.py +0 -0
  36. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/monitoring/start.py +0 -0
  37. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/__init__.py +0 -0
  38. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/camera.py +0 -0
  39. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/tools.py +0 -0
  40. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo/network/tunnel.py +0 -0
  41. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/dependency_links.txt +0 -0
  42. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/entry_points.txt +0 -0
  43. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/requires.txt +0 -0
  44. {sciveo-0.1.18 → sciveo-0.1.19}/sciveo.egg-info/top_level.txt +0 -0
  45. {sciveo-0.1.18 → sciveo-0.1.19}/setup.cfg +0 -0
  46. {sciveo-0.1.18 → sciveo-0.1.19}/setup.py +0 -0
  47. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_compress.py +0 -0
  48. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_configuration.py +0 -0
  49. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_crypto.py +0 -0
  50. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_monitoring.py +0 -0
  51. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_runner.py +0 -0
  52. {sciveo-0.1.18 → sciveo-0.1.19}/test/test_sampling.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -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]
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.1.19'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -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
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.1.18'
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