fxn 0.0.29__tar.gz → 0.0.30__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 (41) hide show
  1. {fxn-0.0.29 → fxn-0.0.30}/PKG-INFO +2 -2
  2. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/prediction/service.py +19 -12
  3. {fxn-0.0.29 → fxn-0.0.30}/fxn/version.py +1 -1
  4. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/PKG-INFO +2 -2
  5. {fxn-0.0.29 → fxn-0.0.30}/setup.py +1 -1
  6. {fxn-0.0.29 → fxn-0.0.30}/LICENSE +0 -0
  7. {fxn-0.0.29 → fxn-0.0.30}/README.md +0 -0
  8. {fxn-0.0.29 → fxn-0.0.30}/fxn/__init__.py +0 -0
  9. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/__init__.py +0 -0
  10. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/auth.py +0 -0
  11. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/env.py +0 -0
  12. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/misc.py +0 -0
  13. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/predict.py +0 -0
  14. {fxn-0.0.29 → fxn-0.0.30}/fxn/cli/predictors.py +0 -0
  15. {fxn-0.0.29 → fxn-0.0.30}/fxn/function.py +0 -0
  16. {fxn-0.0.29 → fxn-0.0.30}/fxn/graph/__init__.py +0 -0
  17. {fxn-0.0.29 → fxn-0.0.30}/fxn/graph/client.py +0 -0
  18. {fxn-0.0.29 → fxn-0.0.30}/fxn/magic.py +0 -0
  19. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/__init__.py +0 -0
  20. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/environment.py +0 -0
  21. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/prediction/__init__.py +0 -0
  22. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/prediction/fxnc.py +0 -0
  23. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/predictor.py +0 -0
  24. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/storage.py +0 -0
  25. {fxn-0.0.29 → fxn-0.0.30}/fxn/services/user.py +0 -0
  26. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/__init__.py +0 -0
  27. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/dtype.py +0 -0
  28. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/environment.py +0 -0
  29. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/prediction.py +0 -0
  30. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/predictor.py +0 -0
  31. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/profile.py +0 -0
  32. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/storage.py +0 -0
  33. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/tag.py +0 -0
  34. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/user.py +0 -0
  35. {fxn-0.0.29 → fxn-0.0.30}/fxn/types/value.py +0 -0
  36. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/SOURCES.txt +0 -0
  37. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/dependency_links.txt +0 -0
  38. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/entry_points.txt +0 -0
  39. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/requires.txt +0 -0
  40. {fxn-0.0.29 → fxn-0.0.30}/fxn.egg-info/top_level.txt +0 -0
  41. {fxn-0.0.29 → fxn-0.0.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
5
  Home-page: https://fxn.ai
6
6
  Author: NatML Inc.
@@ -14,7 +14,7 @@ Classifier: License :: OSI Approved :: Apache Software License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Topic :: Scientific/Engineering :: Image Recognition
16
16
  Classifier: Topic :: Software Development :: Libraries
17
- Requires-Python: >=3.7
17
+ Requires-Python: >=3.9
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
 
@@ -7,9 +7,9 @@ from aiohttp import ClientSession
7
7
  from ctypes import byref, c_double, c_int32, create_string_buffer
8
8
  from dataclasses import asdict, is_dataclass
9
9
  from datetime import datetime, timezone
10
- from filetype import guess_mime
11
10
  from io import BytesIO
12
11
  from json import dumps, loads
12
+ from magika import Magika
13
13
  from numpy import array, float32, frombuffer, int32, ndarray
14
14
  from numpy.typing import NDArray
15
15
  from pathlib import Path
@@ -367,28 +367,35 @@ class PredictionService:
367
367
  )
368
368
  finally:
369
369
  fxnc.FXNProfileRelease(profile)
370
- #fxnc.FXNValueMapRelease(input_map)
370
+ fxnc.FXNValueMapRelease(input_map)
371
371
  fxnc.FXNValueMapRelease(output_map)
372
372
 
373
- def __parse_prediction (self, data: Dict[str, Any], *, raw_outputs: bool, return_binary_path: bool) -> Prediction:
373
+ def __parse_prediction (
374
+ self,
375
+ data: Dict[str, Any],
376
+ *,
377
+ raw_outputs: bool,
378
+ return_binary_path: bool
379
+ ) -> Prediction:
374
380
  prediction = Prediction(**data)
375
381
  prediction.results = [Value(**value) for value in prediction.results] if prediction.results is not None else None
376
382
  prediction.results = [self.to_object(value, return_binary_path=return_binary_path) for value in prediction.results] if prediction.results is not None and not raw_outputs else prediction.results
377
383
  return prediction
378
384
 
379
385
  def __get_data_dtype (self, data: Union[Path, BytesIO]) -> Dtype:
380
- mime = guess_mime(str(data) if isinstance(data, Path) else data)
381
- if not mime:
382
- return Dtype.binary
383
- if mime.startswith("image"):
386
+ magika = Magika()
387
+ result = magika.identify_bytes(data.getvalue()) if isinstance(data, BytesIO) else magika.identify_path(data)
388
+ group = result.output.group
389
+ if group == "image":
384
390
  return Dtype.image
385
- if mime.startswith("video"):
386
- return Dtype.video
387
- if mime.startswith("audio"):
391
+ elif group == "audio":
388
392
  return Dtype.audio
389
- if isinstance(data, Path) and data.suffix in [".obj", ".gltf", ".glb", ".fbx", ".usd", ".usdz", ".blend"]:
393
+ elif group == "video":
394
+ return Dtype.video
395
+ elif isinstance(data, Path) and data.suffix in [".obj", ".gltf", ".glb", ".fbx", ".usd", ".usdz", ".blend"]:
390
396
  return Dtype._3d
391
- return Dtype.binary
397
+ else:
398
+ return Dtype.binary
392
399
 
393
400
  def __download_value_data (self, url: str) -> BytesIO:
394
401
  if url.startswith("data:"):
@@ -3,4 +3,4 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- __version__ = "0.0.29"
6
+ __version__ = "0.0.30"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
5
  Home-page: https://fxn.ai
6
6
  Author: NatML Inc.
@@ -14,7 +14,7 @@ Classifier: License :: OSI Approved :: Apache Software License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Topic :: Scientific/Engineering :: Image Recognition
16
16
  Classifier: Topic :: Software Development :: Libraries
17
- Requires-Python: >=3.7
17
+ Requires-Python: >=3.9
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
 
@@ -25,7 +25,7 @@ setup(
25
25
  long_description=long_description,
26
26
  long_description_content_type="text/markdown",
27
27
  license="Apache License 2.0",
28
- python_requires=">=3.7",
28
+ python_requires=">=3.9",
29
29
  install_requires=[
30
30
  "aiohttp",
31
31
  "magika",
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