featrixsphere 0.2.1235__tar.gz → 0.2.1237__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 (19) hide show
  1. {featrixsphere-0.2.1235/featrixsphere.egg-info → featrixsphere-0.2.1237}/PKG-INFO +1 -1
  2. featrixsphere-0.2.1237/VERSION +1 -0
  3. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere/__init__.py +1 -1
  4. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere/client.py +57 -53
  5. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237/featrixsphere.egg-info}/PKG-INFO +1 -1
  6. featrixsphere-0.2.1235/VERSION +0 -1
  7. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/MANIFEST.in +0 -0
  8. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/README.md +0 -0
  9. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere/cli.py +0 -0
  10. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere/test_client.py +0 -0
  11. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/SOURCES.txt +0 -0
  12. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/dependency_links.txt +0 -0
  13. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/entry_points.txt +0 -0
  14. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/not-zip-safe +0 -0
  15. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/requires.txt +0 -0
  16. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/featrixsphere.egg-info/top_level.txt +0 -0
  17. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/requirements.txt +0 -0
  18. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/setup.cfg +0 -0
  19. {featrixsphere-0.2.1235 → featrixsphere-0.2.1237}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: featrixsphere
3
- Version: 0.2.1235
3
+ Version: 0.2.1237
4
4
  Summary: Transform any CSV into a production-ready ML model in minutes, not months.
5
5
  Home-page: https://github.com/Featrix/sphere
6
6
  Author: Featrix
@@ -0,0 +1 @@
1
+ 0.2.1237
@@ -38,7 +38,7 @@ Example:
38
38
  ... labels=['Experiment A', 'Experiment B'])
39
39
  """
40
40
 
41
- __version__ = "0.2.1235"
41
+ __version__ = "0.2.1237"
42
42
  __author__ = "Featrix"
43
43
  __email__ = "support@featrix.com"
44
44
  __license__ = "MIT"
@@ -4213,74 +4213,60 @@ class FeatrixSphereClient:
4213
4213
  if input_filename and df is not None:
4214
4214
  raise ValueError("Provide either input_filename or df, not both")
4215
4215
 
4216
- # If DataFrame provided, save to temp file and upload it
4217
- temp_file = None
4218
- if df is not None:
4219
- import pandas as pd
4220
- import tempfile
4221
- import os
4222
-
4223
- if not isinstance(df, pd.DataFrame):
4224
- raise ValueError("df must be a pandas DataFrame")
4225
-
4226
- if verbose:
4227
- print(f"📊 Using provided DataFrame ({len(df)} rows, {len(df.columns)} columns)")
4228
-
4229
- # Create temporary CSV file
4230
- temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False)
4231
- temp_file_path = temp_file.name
4232
- temp_file.close()
4233
-
4234
- # Save DataFrame to temp file
4235
- df.to_csv(temp_file_path, index=False)
4236
-
4237
- if verbose:
4238
- print(f"📁 Saved to temporary file: {os.path.basename(temp_file_path)}")
4239
- print(f"📤 Uploading file to server...")
4240
-
4241
- # Upload the file
4242
- uploaded_filename = self.upload_file(temp_file_path)
4243
- input_filename = uploaded_filename
4244
-
4245
- if verbose:
4246
- print(f"✅ File uploaded: {input_filename}")
4247
-
4248
- # Clean up temp file
4249
- try:
4250
- os.unlink(temp_file_path)
4251
- except Exception:
4252
- pass # Ignore cleanup errors
4253
-
4216
+ # Prepare multipart form data (like train_single_predictor_with_file does)
4217
+ files = None
4254
4218
  data = {
4255
4219
  "foundation_model_id": foundation_model_id,
4256
4220
  "target_column": target_column,
4257
4221
  "target_column_type": target_column_type,
4258
- "epochs": epochs,
4222
+ "epochs": str(epochs),
4259
4223
  "optimize_for": optimize_for,
4260
4224
  }
4261
4225
 
4262
- if input_filename:
4263
- # If absolute path provided, upload the file first
4226
+ # Handle file upload - send file directly in multipart form
4227
+ if df is not None:
4228
+ import pandas as pd
4229
+ import tempfile
4230
+ import os
4231
+
4232
+ if not isinstance(df, pd.DataFrame):
4233
+ raise ValueError("df must be a pandas DataFrame")
4234
+
4235
+ if verbose:
4236
+ print(f"📊 Using provided DataFrame ({len(df)} rows, {len(df.columns)} columns)")
4237
+
4238
+ # Create temporary CSV file
4239
+ temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False)
4240
+ temp_file_path = temp_file.name
4241
+ temp_file.close()
4242
+
4243
+ # Save DataFrame to temp file
4244
+ df.to_csv(temp_file_path, index=False)
4245
+
4246
+ if verbose:
4247
+ print(f"📁 Saved to temporary file: {os.path.basename(temp_file_path)}")
4248
+ print(f"📤 Uploading file directly with training request...")
4249
+
4250
+ # Send file in multipart form
4251
+ files = {'file': (os.path.basename(temp_file_path), open(temp_file_path, 'rb'), 'text/csv')}
4252
+
4253
+ elif input_filename:
4254
+ # If absolute path provided, send file directly
4264
4255
  from pathlib import Path
4265
4256
  input_path = Path(input_filename)
4266
4257
  if input_path.is_absolute():
4267
- # Upload the file first, then use the uploaded filename
4268
4258
  if not input_path.exists():
4269
4259
  raise FileNotFoundError(f"Input file not found: {input_filename}")
4270
4260
 
4271
4261
  if verbose:
4272
- print(f"📤 Uploading file from absolute path: {input_filename}")
4273
-
4274
- # Upload the file
4275
- uploaded_filename = self.upload_file(str(input_path))
4276
-
4277
- if verbose:
4278
- print(f"✅ File uploaded as: {uploaded_filename}")
4262
+ print(f"📤 Sending file directly from absolute path: {input_filename}")
4279
4263
 
4280
- data["input_filename"] = uploaded_filename
4264
+ # Send file in multipart form
4265
+ files = {'file': (input_path.name, open(input_path, 'rb'), 'text/csv' if input_path.suffix == '.csv' else 'application/gzip')}
4281
4266
  else:
4282
4267
  # Relative filename - assume it's already on the server
4283
4268
  data["input_filename"] = input_filename
4269
+
4284
4270
  if name:
4285
4271
  data["name"] = name
4286
4272
  if session_name_prefix:
@@ -4288,11 +4274,29 @@ class FeatrixSphereClient:
4288
4274
  if rare_label_value:
4289
4275
  data["rare_label_value"] = rare_label_value
4290
4276
  if class_imbalance:
4291
- data["class_imbalance"] = class_imbalance
4277
+ import json
4278
+ data["class_imbalance"] = json.dumps(class_imbalance)
4292
4279
  if webhooks:
4293
- data["webhooks"] = webhooks
4280
+ import json
4281
+ data["webhooks"] = json.dumps(webhooks)
4294
4282
 
4295
- response_data = self._post_json("/compute/train_on_foundational_model", data)
4283
+ # Send request with file if provided
4284
+ try:
4285
+ if files:
4286
+ response = self._make_request("POST", "/compute/train_on_foundational_model", files=files, data=data)
4287
+ else:
4288
+ response = self._make_request("POST", "/compute/train_on_foundational_model", json=data)
4289
+ response_data = response.json()
4290
+ finally:
4291
+ # Close file handles
4292
+ if files and 'file' in files:
4293
+ files['file'][1].close()
4294
+ # Clean up temp file if we created one
4295
+ if df is not None and temp_file_path:
4296
+ try:
4297
+ os.unlink(temp_file_path)
4298
+ except Exception:
4299
+ pass
4296
4300
 
4297
4301
  new_session_id = response_data.get('session_id')
4298
4302
  print(f"✅ Predictor training session created: {new_session_id}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: featrixsphere
3
- Version: 0.2.1235
3
+ Version: 0.2.1237
4
4
  Summary: Transform any CSV into a production-ready ML model in minutes, not months.
5
5
  Home-page: https://github.com/Featrix/sphere
6
6
  Author: Featrix
@@ -1 +0,0 @@
1
- 0.2.1235