opengradient 0.2.5__py3-none-any.whl → 0.2.6__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.
opengradient/__init__.py CHANGED
@@ -2,7 +2,7 @@ from .client import Client
2
2
  from .exceptions import OpenGradientError, FileNotFoundError, UploadError, InferenceError, ResultRetrievalError
3
3
  from .types import ModelInput, InferenceMode, Number, NumberTensor, StringTensor, ModelOutput
4
4
 
5
- __version__ = "0.2.5"
5
+ __version__ = "0.2.6"
6
6
 
7
7
  _client = None
8
8
 
opengradient/client.py CHANGED
@@ -112,12 +112,12 @@ class Client:
112
112
  # Create the specified version for the newly created model
113
113
  try:
114
114
  version_response = self.create_version(model_id, version)
115
- logging.info(f"Version creation successful. Version ID: {version_response['version_id']}")
115
+ logging.info(f"Version creation successful. Version ID: {version_response['versionString']}")
116
116
  except Exception as ve:
117
117
  logging.error(f"Version creation failed, but model was created. Error: {str(ve)}")
118
- return {"id": model_id, "version_id": None, "version_error": str(ve)}
118
+ return {"id": model_id, "versionString": None, "version_error": str(ve)}
119
119
 
120
- return {"id": model_id, "version_id": version_response["version_id"]}
120
+ return {"id": model_id, "versionString": version_response["versionString"]}
121
121
 
122
122
  except requests.RequestException as e:
123
123
  logging.error(f"Model creation failed: {str(e)}")
@@ -172,14 +172,14 @@ class Client:
172
172
 
173
173
  if isinstance(json_response, list) and not json_response:
174
174
  logging.info(f"Server returned an empty list. Assuming version was created successfully.")
175
- return {"version_id": "Unknown", "note": "Created based on empty response"}
175
+ return {"versionString": "Unknown", "note": "Created based on empty response"}
176
176
  elif isinstance(json_response, dict):
177
- version_id = json_response.get('version_id') or json_response.get('id')
178
- if not version_id:
179
- logging.warning(f"'version_id' not found in response. Response: {json_response}")
180
- return {"version_id": "Unknown", "note": "Version ID not provided in response"}
181
- logging.info(f"Version creation successful. Version ID: {version_id}")
182
- return {"version_id": version_id}
177
+ versionString = json_response.get('versionString')
178
+ if not versionString:
179
+ logging.warning(f"'versionString' not found in response. Response: {json_response}")
180
+ return {"versionString": "Unknown", "note": "Version ID not provided in response"}
181
+ logging.info(f"Version creation successful. Version ID: {versionString}")
182
+ return {"versionString": versionString}
183
183
  else:
184
184
  logging.error(f"Unexpected response type: {type(json_response)}. Content: {json_response}")
185
185
  raise Exception(f"Unexpected response type: {type(json_response)}")
@@ -205,7 +205,7 @@ class Client:
205
205
  version (str): The version identifier for the model.
206
206
 
207
207
  Returns:
208
- dict: The server response containing the model CID and size.
208
+ dict: The processed result.
209
209
 
210
210
  Raises:
211
211
  OpenGradientError: If the upload fails.
@@ -247,17 +247,17 @@ class Client:
247
247
  response = requests.post(url, data=monitor, headers=headers, timeout=3600) # 1 hour timeout
248
248
 
249
249
  logging.info(f"Response received. Status code: {response.status_code}")
250
- logging.debug(f"Response headers: {response.headers}")
251
- logging.debug(f"Response content: {response.text[:1000]}...") # Log first 1000 characters
250
+ logging.info(f"Full response content: {response.text}") # Log the full response content
252
251
 
253
252
  if response.status_code == 201:
254
253
  if response.content and response.content != b'null':
255
254
  json_response = response.json()
256
- logging.info(f"Upload successful. CID: {json_response.get('cid', 'N/A')}")
257
- return {"model_cid": json_response.get("ipfs_cid"), "size": json_response.get("size")}
255
+ logging.info(f"JSON response: {json_response}") # Log the parsed JSON response
256
+ logging.info(f"Upload successful. CID: {json_response.get('ipfsCid', 'N/A')}")
257
+ result = {"model_cid": json_response.get("ipfsCid"), "size": json_response.get("size")}
258
258
  else:
259
259
  logging.warning("Empty or null response content received. Assuming upload was successful.")
260
- return {"model_cid": None, "size": None}
260
+ result = {"model_cid": None, "size": None}
261
261
  elif response.status_code == 500:
262
262
  error_message = "Internal server error occurred. Please try again later or contact support."
263
263
  logging.error(error_message)
@@ -267,6 +267,8 @@ class Client:
267
267
  logging.error(f"Upload failed with status code {response.status_code}: {error_message}")
268
268
  raise OpenGradientError(f"Upload failed: {error_message}", status_code=response.status_code)
269
269
 
270
+ return result
271
+
270
272
  except requests.RequestException as e:
271
273
  logging.error(f"Request exception during upload: {str(e)}")
272
274
  if hasattr(e, 'response') and e.response is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opengradient
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: A Python SDK for OpenGradient inference services
5
5
  Author-email: OpenGradient <oliver@opengradient.ai>
6
6
  License: MIT License
@@ -0,0 +1,13 @@
1
+ opengradient/__init__.py,sha256=sImAqtmJU03jhmPXCye37bLu_KGILDCmCRLpS8S2HcI,1783
2
+ opengradient/cli.py,sha256=U0hEQEab5-D-Abkxs1WmV4Qbalth80MBwBDnOCK4hWc,7354
3
+ opengradient/client.py,sha256=tPHTi4rZiZ5Kf_XKdfD3uJZFP2j4AO4ld2lJS38nj24,18026
4
+ opengradient/exceptions.py,sha256=v4VmUGTvvtjhCZAhR24Ga42z3q-DzR1Y5zSqP_yn2Xk,3366
5
+ opengradient/types.py,sha256=EoJN-DkQrJ2WTUv8OenlrlWJWFY2jPGTl-T8C_OVjp8,1849
6
+ opengradient/utils.py,sha256=95i5RVn-32MRsn00M21io8QHLtmEAoRbgueMhDh0TVk,5079
7
+ opengradient/abi/inference.abi,sha256=HH2SmCJ_D4O0I-CFsln0vFHd2PU-A-fxgCnUtHg0ZQg,2373
8
+ opengradient-0.2.6.dist-info/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
9
+ opengradient-0.2.6.dist-info/METADATA,sha256=au_A8g75nxOpqCoo6zuHBQmKVNwxu_9sUGBMlVI1ybY,3000
10
+ opengradient-0.2.6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
+ opengradient-0.2.6.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
12
+ opengradient-0.2.6.dist-info/top_level.txt,sha256=oC1zimVLa2Yi1LQz8c7x-0IQm92milb5ax8gHBHwDqU,13
13
+ opengradient-0.2.6.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- opengradient/__init__.py,sha256=KEs28Cnki2uQk3XMb2z2U0wPI7q5JXn0HToJMUmQDZI,1783
2
- opengradient/cli.py,sha256=U0hEQEab5-D-Abkxs1WmV4Qbalth80MBwBDnOCK4hWc,7354
3
- opengradient/client.py,sha256=hmBIb_UXMfcAXIfDAd9Baxwd9SDsLzPLBFaH8efS1IY,17978
4
- opengradient/exceptions.py,sha256=v4VmUGTvvtjhCZAhR24Ga42z3q-DzR1Y5zSqP_yn2Xk,3366
5
- opengradient/types.py,sha256=EoJN-DkQrJ2WTUv8OenlrlWJWFY2jPGTl-T8C_OVjp8,1849
6
- opengradient/utils.py,sha256=95i5RVn-32MRsn00M21io8QHLtmEAoRbgueMhDh0TVk,5079
7
- opengradient/abi/inference.abi,sha256=HH2SmCJ_D4O0I-CFsln0vFHd2PU-A-fxgCnUtHg0ZQg,2373
8
- opengradient-0.2.5.dist-info/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
9
- opengradient-0.2.5.dist-info/METADATA,sha256=VaOmJ1SXmpooKgm1zJKTgXjkSOI4r5YBG4-qs3qxAKs,3000
10
- opengradient-0.2.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- opengradient-0.2.5.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
12
- opengradient-0.2.5.dist-info/top_level.txt,sha256=oC1zimVLa2Yi1LQz8c7x-0IQm92milb5ax8gHBHwDqU,13
13
- opengradient-0.2.5.dist-info/RECORD,,