inferencesh 0.1.12__py3-none-any.whl → 0.1.14__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.
Potentially problematic release.
This version of inferencesh might be problematic. Click here for more details.
- inferencesh/sdk.py +11 -7
- {inferencesh-0.1.12.dist-info → inferencesh-0.1.14.dist-info}/METADATA +1 -1
- inferencesh-0.1.14.dist-info/RECORD +8 -0
- {inferencesh-0.1.12.dist-info → inferencesh-0.1.14.dist-info}/WHEEL +1 -1
- inferencesh-0.1.12.dist-info/RECORD +0 -8
- {inferencesh-0.1.12.dist-info → inferencesh-0.1.14.dist-info}/LICENSE +0 -0
- {inferencesh-0.1.12.dist-info → inferencesh-0.1.14.dist-info}/entry_points.txt +0 -0
- {inferencesh-0.1.12.dist-info → inferencesh-0.1.14.dist-info}/top_level.txt +0 -0
inferencesh/sdk.py
CHANGED
|
@@ -101,27 +101,31 @@ class BaseApp(BaseModel):
|
|
|
101
101
|
|
|
102
102
|
class File(BaseModel):
|
|
103
103
|
"""A class representing a file in the inference.sh ecosystem."""
|
|
104
|
-
|
|
104
|
+
uri: str # Original location (URL or file path)
|
|
105
|
+
path: Optional[str] = None # Resolved local file path
|
|
105
106
|
mime_type: Optional[str] = None # MIME type of the file
|
|
106
107
|
size: Optional[int] = None # File size in bytes
|
|
107
108
|
filename: Optional[str] = None # Original filename if available
|
|
108
|
-
_tmp_path: Optional[str] = None # Internal storage for temporary file path
|
|
109
|
+
_tmp_path: Optional[str] = PrivateAttr(default=None) # Internal storage for temporary file path
|
|
109
110
|
|
|
110
111
|
def __init__(self, **data):
|
|
111
112
|
super().__init__(**data)
|
|
112
|
-
if self._is_url(self.
|
|
113
|
+
if self._is_url(self.uri):
|
|
113
114
|
self._download_url()
|
|
114
|
-
elif not os.path.isabs(self.
|
|
115
|
-
self.path = os.path.abspath(self.
|
|
115
|
+
elif not os.path.isabs(self.uri):
|
|
116
|
+
self.path = os.path.abspath(self.uri)
|
|
117
|
+
else:
|
|
118
|
+
self.path = self.uri
|
|
116
119
|
self._populate_metadata()
|
|
117
120
|
|
|
118
121
|
def _is_url(self, path: str) -> bool:
|
|
119
122
|
"""Check if the path is a URL."""
|
|
120
123
|
parsed = urllib.parse.urlparse(path)
|
|
121
124
|
return parsed.scheme in ('http', 'https')
|
|
125
|
+
|
|
122
126
|
def _download_url(self) -> None:
|
|
123
127
|
"""Download the URL to a temporary file and update the path."""
|
|
124
|
-
original_url = self.
|
|
128
|
+
original_url = self.uri
|
|
125
129
|
tmp_file = None
|
|
126
130
|
try:
|
|
127
131
|
# Create a temporary file with a suffix based on the URL path
|
|
@@ -179,7 +183,7 @@ class File(BaseModel):
|
|
|
179
183
|
@classmethod
|
|
180
184
|
def from_path(cls, path: Union[str, os.PathLike]) -> 'File':
|
|
181
185
|
"""Create a File instance from a file path."""
|
|
182
|
-
return cls(
|
|
186
|
+
return cls(uri=str(path))
|
|
183
187
|
|
|
184
188
|
def _guess_mime_type(self) -> Optional[str]:
|
|
185
189
|
"""Guess the MIME type of the file."""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
inferencesh/__init__.py,sha256=pR0MXSJe41LgJkjGK-jhZR7LjqCFdRZtNTV6qcjYSTI,123
|
|
2
|
+
inferencesh/sdk.py,sha256=hfdaQs-ojHStDOqgBpNEXsqF8VmutbT-0mgQMm3PSVQ,7843
|
|
3
|
+
inferencesh-0.1.14.dist-info/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
4
|
+
inferencesh-0.1.14.dist-info/METADATA,sha256=_e4fr2uefeABHk6hwnWnHDddL8QT-mFYrE7dRaIp9gA,2584
|
|
5
|
+
inferencesh-0.1.14.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
6
|
+
inferencesh-0.1.14.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
7
|
+
inferencesh-0.1.14.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
8
|
+
inferencesh-0.1.14.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
inferencesh/__init__.py,sha256=pR0MXSJe41LgJkjGK-jhZR7LjqCFdRZtNTV6qcjYSTI,123
|
|
2
|
-
inferencesh/sdk.py,sha256=OJsbJlaQFewO6ncikfgGMnxs7TBLhxw_icNoHsqeIqw,7717
|
|
3
|
-
inferencesh-0.1.12.dist-info/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
4
|
-
inferencesh-0.1.12.dist-info/METADATA,sha256=J39n1MJJ6ZlQr5uokw_1rhryoeofKaiVIyvTxsEUaF8,2584
|
|
5
|
-
inferencesh-0.1.12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
6
|
-
inferencesh-0.1.12.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
7
|
-
inferencesh-0.1.12.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
8
|
-
inferencesh-0.1.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|