mostlyai 0.3.4__tar.gz → 0.3.6__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.
- {mostlyai-0.3.4 → mostlyai-0.3.6}/PKG-INFO +12 -5
- {mostlyai-0.3.4 → mostlyai-0.3.6}/README.md +8 -1
- mostlyai-0.3.6/mostlyai/__init__.py +3 -0
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/api.py +157 -145
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/connectors.py +7 -1
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/generators.py +7 -5
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/model.py +240 -78
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/synthetic_datasets.py +29 -27
- mostlyai-0.3.6/mostlyai/utils.py +262 -0
- {mostlyai-0.3.4 → mostlyai-0.3.6}/pyproject.toml +7 -13
- mostlyai-0.3.4/mostlyai/__init__.py +0 -1
- mostlyai-0.3.4/mostlyai/utils.py +0 -157
- {mostlyai-0.3.4 → mostlyai-0.3.6}/LICENSE +0 -0
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/base.py +0 -0
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.3.4 → mostlyai-0.3.6}/mostlyai/shares.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: The official Python client for the MOSTLY AI platform.
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Proprietary
|
|
@@ -13,11 +13,11 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Requires-Dist: httpx (>=0.25.
|
|
16
|
+
Requires-Dist: httpx (>=0.25.0)
|
|
17
17
|
Requires-Dist: pandas (>=1.5.3,<3.0.0)
|
|
18
|
-
Requires-Dist: pyarrow (>=14.0.
|
|
18
|
+
Requires-Dist: pyarrow (>=14.0.0)
|
|
19
19
|
Requires-Dist: pydantic (>=2.4.2,<3.0.0)
|
|
20
|
-
Requires-Dist: rich (>=13.7.0
|
|
20
|
+
Requires-Dist: rich (>=13.7.0)
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
23
|
# MOSTLY AI - GenAI for Tabular Data
|
|
@@ -44,7 +44,7 @@ pip install mostlyai
|
|
|
44
44
|
## Basic Usage
|
|
45
45
|
```python
|
|
46
46
|
from mostlyai import MostlyAI
|
|
47
|
-
mostly = MostlyAI(api_key='your_api_key')
|
|
47
|
+
mostly = MostlyAI(api_key='your_api_key')
|
|
48
48
|
g = mostly.train(data) # train a generator on your data
|
|
49
49
|
sd = mostly.generate(g) # generate a synthetic dataset
|
|
50
50
|
syn = sd.data() # consume synthetic as pd.DataFrame
|
|
@@ -113,6 +113,13 @@ sd.data()
|
|
|
113
113
|
sd.download(file, format)
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Synthetic Probes
|
|
117
|
+
```python
|
|
118
|
+
sp = mostly.probe(g, seed=seed)
|
|
119
|
+
sp = mostly.probe(g, size=size)
|
|
120
|
+
sp = mostly.probe(g, config=config)
|
|
121
|
+
```
|
|
122
|
+
|
|
116
123
|
### Sharing
|
|
117
124
|
|
|
118
125
|
```python
|
|
@@ -22,7 +22,7 @@ pip install mostlyai
|
|
|
22
22
|
## Basic Usage
|
|
23
23
|
```python
|
|
24
24
|
from mostlyai import MostlyAI
|
|
25
|
-
mostly = MostlyAI(api_key='your_api_key')
|
|
25
|
+
mostly = MostlyAI(api_key='your_api_key')
|
|
26
26
|
g = mostly.train(data) # train a generator on your data
|
|
27
27
|
sd = mostly.generate(g) # generate a synthetic dataset
|
|
28
28
|
syn = sd.data() # consume synthetic as pd.DataFrame
|
|
@@ -91,6 +91,13 @@ sd.data()
|
|
|
91
91
|
sd.download(file, format)
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
### Synthetic Probes
|
|
95
|
+
```python
|
|
96
|
+
sp = mostly.probe(g, seed=seed)
|
|
97
|
+
sp = mostly.probe(g, size=size)
|
|
98
|
+
sp = mostly.probe(g, config=config)
|
|
99
|
+
```
|
|
100
|
+
|
|
94
101
|
### Sharing
|
|
95
102
|
|
|
96
103
|
```python
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import Any, Optional, Union
|
|
2
|
+
from typing import Any, Optional, Union, Literal
|
|
3
3
|
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import rich
|
|
@@ -13,13 +13,18 @@ from mostlyai.model import (
|
|
|
13
13
|
Generator,
|
|
14
14
|
PermissionLevel,
|
|
15
15
|
ProgressStatus,
|
|
16
|
+
SyntheticDataset,
|
|
16
17
|
)
|
|
17
18
|
from mostlyai.shares import _MostlySharesClient
|
|
18
|
-
from mostlyai.synthetic_datasets import
|
|
19
|
+
from mostlyai.synthetic_datasets import (
|
|
20
|
+
_MostlySyntheticDatasetsClient,
|
|
21
|
+
_MostlySyntheticProbesClient,
|
|
22
|
+
)
|
|
19
23
|
from mostlyai.utils import (
|
|
20
24
|
ShareableResource,
|
|
21
|
-
_get_subject_table_names,
|
|
22
25
|
_read_table_from_path,
|
|
26
|
+
_harmonize_sd_config,
|
|
27
|
+
Seed,
|
|
23
28
|
)
|
|
24
29
|
|
|
25
30
|
|
|
@@ -52,6 +57,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
52
57
|
self.connectors = _MostlyConnectorsClient(**client_kwargs)
|
|
53
58
|
self.generators = _MostlyGeneratorsClient(**client_kwargs)
|
|
54
59
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
60
|
+
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
55
61
|
self.shares = _MostlySharesClient(**client_kwargs)
|
|
56
62
|
|
|
57
63
|
def connect(self, config: dict[str, Any]) -> Connector:
|
|
@@ -60,108 +66,119 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
60
66
|
|
|
61
67
|
If validation fails, a 400 status with an error message will be returned.
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
69
|
+
`config` is a dictionary with the keys `type`, `config`, `secrets`, and `ssl`.
|
|
70
|
+
The structures of the `config`, `secrets` and `ssl` parameters depend on the connector `type`:
|
|
71
|
+
|
|
72
|
+
- Cloud storage:
|
|
73
|
+
```yaml
|
|
74
|
+
- type: AZURE_STORAGE
|
|
75
|
+
config:
|
|
76
|
+
accountName: string
|
|
77
|
+
clientId: string (required for auth via service principal)
|
|
78
|
+
tenantId: string (required for auth via service principal)
|
|
79
|
+
secrets:
|
|
80
|
+
accountKey: string (required for regular auth)
|
|
81
|
+
clientSecret: string (required for auth via service principal)
|
|
82
|
+
|
|
83
|
+
- type: GOOGLE_CLOUD_STORAGE
|
|
84
|
+
config:
|
|
85
|
+
secrets:
|
|
86
|
+
keyFile: string
|
|
87
|
+
|
|
88
|
+
- type: S3_STORAGE
|
|
89
|
+
config:
|
|
90
|
+
accessKey: string
|
|
91
|
+
endpointUrl: string (only needed for S3-compatible storage services other than AWS)
|
|
92
|
+
secrets:
|
|
93
|
+
secretKey: string
|
|
94
|
+
```
|
|
95
|
+
- Database:
|
|
96
|
+
```yaml
|
|
97
|
+
- type: BIGQUERY
|
|
98
|
+
config:
|
|
99
|
+
secrets:
|
|
100
|
+
keyFile: string
|
|
101
|
+
|
|
102
|
+
- type: DATABRICKS
|
|
103
|
+
config:
|
|
104
|
+
host: string
|
|
105
|
+
httpPath: string
|
|
106
|
+
catalog: string
|
|
107
|
+
clientId: string (required for auth via service principal)
|
|
108
|
+
tenantId: string (required for auth via service principal)
|
|
109
|
+
secrets:
|
|
110
|
+
accessToken: string (required for regular auth)
|
|
111
|
+
clientSecret: string (required for auth via service principal)
|
|
112
|
+
|
|
113
|
+
- type: HIVE
|
|
114
|
+
config:
|
|
115
|
+
host: string
|
|
116
|
+
port: integer, default: 10000
|
|
117
|
+
username: string (required for regular auth)
|
|
118
|
+
kerberos_enabled: boolean, default: false
|
|
119
|
+
kerberos_principal: string (required if kerberos_enabled)
|
|
120
|
+
kerberos_krb5_conf: string (required if kerberos_enabled)
|
|
121
|
+
secrets:
|
|
122
|
+
password: string (required for regular auth)
|
|
123
|
+
kerberos_keytab: base64-encoded string (required if kerberos_enabled)
|
|
124
|
+
|
|
125
|
+
- type: MARIADB
|
|
126
|
+
config:
|
|
127
|
+
host: string
|
|
128
|
+
port: integer, default: 3306
|
|
129
|
+
username: string
|
|
130
|
+
secrets:
|
|
131
|
+
password: string
|
|
132
|
+
|
|
133
|
+
- type: MSSQL
|
|
134
|
+
config:
|
|
135
|
+
host: string
|
|
136
|
+
port: integer, default: 1433
|
|
137
|
+
username: string
|
|
138
|
+
database: string
|
|
139
|
+
secrets:
|
|
140
|
+
password: string
|
|
141
|
+
|
|
142
|
+
- type: MYSQL
|
|
143
|
+
config:
|
|
144
|
+
host: string
|
|
145
|
+
port: integer, default: 3306
|
|
146
|
+
username: string
|
|
147
|
+
secrets:
|
|
148
|
+
password: string
|
|
149
|
+
|
|
150
|
+
- type: ORACLE
|
|
151
|
+
config:
|
|
152
|
+
host: string
|
|
153
|
+
port: integer, default: 1521
|
|
154
|
+
username: string
|
|
155
|
+
connectionType: enum {SID, SERVICE_NAME}, default: SID
|
|
156
|
+
database: string, default: ORCL
|
|
157
|
+
secrets:
|
|
158
|
+
password: string
|
|
159
|
+
|
|
160
|
+
- type: POSTGRES
|
|
161
|
+
config:
|
|
162
|
+
host: string
|
|
163
|
+
port: integer, default: 5432
|
|
164
|
+
username: string
|
|
165
|
+
database: string
|
|
166
|
+
secrets:
|
|
167
|
+
password: string
|
|
168
|
+
ssl:
|
|
169
|
+
rootCertificate: string
|
|
170
|
+
sslCertificate: string
|
|
171
|
+
sslCertificateKey: string
|
|
172
|
+
|
|
173
|
+
- type: SNOWFLAKE
|
|
174
|
+
config:
|
|
175
|
+
account: string
|
|
176
|
+
username: string
|
|
177
|
+
warehouse: string, default: COMPUTE_WH
|
|
178
|
+
database: string
|
|
179
|
+
secrets:
|
|
180
|
+
password: string
|
|
181
|
+
```
|
|
165
182
|
|
|
166
183
|
:return: The created connector.
|
|
167
184
|
"""
|
|
@@ -178,7 +195,8 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
178
195
|
name: Optional[str] = None,
|
|
179
196
|
start: bool = True,
|
|
180
197
|
wait: bool = True,
|
|
181
|
-
|
|
198
|
+
progress_bar: bool = True,
|
|
199
|
+
) -> Generator:
|
|
182
200
|
"""
|
|
183
201
|
Train a generator
|
|
184
202
|
|
|
@@ -187,6 +205,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
187
205
|
:param name: Optional. The name of the generator.
|
|
188
206
|
:param start: If true, then training is started right away. Default: true.
|
|
189
207
|
:param wait: If true, then the function only returns once training has finished. Default: true.
|
|
208
|
+
:param progress_bar: If true, then the progress bar will be displayed, in case of wait=True
|
|
190
209
|
:return: The created generator.
|
|
191
210
|
"""
|
|
192
211
|
if data is not None and config is not None:
|
|
@@ -212,7 +231,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
212
231
|
g.training.start()
|
|
213
232
|
rich.print("Started generator training")
|
|
214
233
|
if start and wait:
|
|
215
|
-
g = g.training.wait()
|
|
234
|
+
g = g.training.wait(progress_bar=progress_bar)
|
|
216
235
|
if g.training_status == ProgressStatus.done:
|
|
217
236
|
rich.print(
|
|
218
237
|
":tada: [bold green]Your generator is ready![/] "
|
|
@@ -225,16 +244,15 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
225
244
|
self,
|
|
226
245
|
generator: Union[Generator, str, None] = None,
|
|
227
246
|
size: Union[int, dict[str, int], None] = None,
|
|
228
|
-
seed: Union[
|
|
229
|
-
pd.DataFrame, str, Path, dict[str, Union[pd.DataFrame, str, Path]], None
|
|
230
|
-
] = None,
|
|
247
|
+
seed: Union[Seed, dict[str, Seed], None] = None,
|
|
231
248
|
config: Union[dict, None] = None,
|
|
232
249
|
name: Optional[str] = None,
|
|
233
250
|
start: bool = True,
|
|
234
251
|
wait: bool = True,
|
|
235
|
-
|
|
252
|
+
progress_bar: bool = True,
|
|
253
|
+
) -> SyntheticDataset:
|
|
236
254
|
"""
|
|
237
|
-
|
|
255
|
+
Generate synthetic data
|
|
238
256
|
|
|
239
257
|
:param generator: The generator instance or its UUID, that is to be used for generating synthetic data.
|
|
240
258
|
:param config: The configuration parameters of the synthetic dataset to be created. See SyntheticDataset.config for the structure of the parameters.
|
|
@@ -243,40 +261,10 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
243
261
|
:param name: Optional. The name of the synthetic dataset.
|
|
244
262
|
:param start: If true, then generation is started right away. Default: true.
|
|
245
263
|
:param wait: If true, then the function only returns once generation has finished. Default: true.
|
|
264
|
+
:param progress_bar: If true, then the progress bar will be displayed, in case of wait=True
|
|
246
265
|
:return: The created synthetic dataset.
|
|
247
266
|
"""
|
|
248
|
-
|
|
249
|
-
config = {}
|
|
250
|
-
if isinstance(generator, Generator):
|
|
251
|
-
config["generatorId"] = str(generator.id)
|
|
252
|
-
elif generator is not None:
|
|
253
|
-
config["generatorId"] = str(generator)
|
|
254
|
-
elif "generatorId" not in config:
|
|
255
|
-
raise ValueError(
|
|
256
|
-
"Either a generator or a configuration with a generatorId must be provided."
|
|
257
|
-
)
|
|
258
|
-
|
|
259
|
-
if "tables" not in config:
|
|
260
|
-
g = self.generators.get(config["generatorId"])
|
|
261
|
-
subject_tables = _get_subject_table_names(g.config())
|
|
262
|
-
config["tables"] = [
|
|
263
|
-
{
|
|
264
|
-
"name": table,
|
|
265
|
-
"configuration": {
|
|
266
|
-
"sampleSize": (
|
|
267
|
-
size.get(table) if isinstance(size, dict) else size
|
|
268
|
-
),
|
|
269
|
-
"sampleSeedData": (
|
|
270
|
-
seed.get(table) if isinstance(seed, dict) else seed
|
|
271
|
-
),
|
|
272
|
-
},
|
|
273
|
-
}
|
|
274
|
-
for table in subject_tables
|
|
275
|
-
]
|
|
276
|
-
|
|
277
|
-
if name is not None:
|
|
278
|
-
config |= {"name": name}
|
|
279
|
-
|
|
267
|
+
config = _harmonize_sd_config(generator, size, seed, config, name)
|
|
280
268
|
sd = self.synthetic_datasets.create(config)
|
|
281
269
|
rich.print(
|
|
282
270
|
f"Created synthetic dataset "
|
|
@@ -288,7 +276,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
288
276
|
sd.generation.start()
|
|
289
277
|
rich.print("Started synthetic dataset generation")
|
|
290
278
|
if start and wait:
|
|
291
|
-
sd = sd.generation.wait()
|
|
279
|
+
sd = sd.generation.wait(progress_bar=progress_bar)
|
|
292
280
|
if sd.generation_status == ProgressStatus.done:
|
|
293
281
|
rich.print(
|
|
294
282
|
":tada: [bold green]Your synthetic dataset is ready![/] "
|
|
@@ -297,6 +285,30 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
297
285
|
)
|
|
298
286
|
return sd
|
|
299
287
|
|
|
288
|
+
def probe(
|
|
289
|
+
self,
|
|
290
|
+
generator: Union[Generator, str, None] = None,
|
|
291
|
+
size: Union[int, dict[str, int], None] = None,
|
|
292
|
+
seed: Union[Seed, dict[str, Seed], None] = None,
|
|
293
|
+
config: Union[dict, None] = None,
|
|
294
|
+
return_type: Literal["auto", "dict"] = "auto",
|
|
295
|
+
) -> Union[pd.DataFrame, dict[str, pd.DataFrame]]:
|
|
296
|
+
"""
|
|
297
|
+
Probe a generator
|
|
298
|
+
|
|
299
|
+
:param generator: The generator instance or its UUID, that is to be used for generating synthetic data.
|
|
300
|
+
:param config: The configuration parameters of the synthetic dataset to be created. See SyntheticDataset.config for the structure of the parameters.
|
|
301
|
+
:param size: Optional. Either a single integer, or a dictionary of integers. Used for specifying the sample_size of the subject table(s).
|
|
302
|
+
:param seed: Optional. Either a single pandas DataFrame data, or a path to a CSV or PARQUET file, or list of samples, or a dictionary of those. Used for seeding the subject table(s).
|
|
303
|
+
:return: The created synthetic probe.
|
|
304
|
+
"""
|
|
305
|
+
config = _harmonize_sd_config(generator, size, seed, config)
|
|
306
|
+
dfs = self.synthetic_probes.create(config)
|
|
307
|
+
if return_type == "auto" and len(dfs) == 1:
|
|
308
|
+
return list(dfs.values())[0]
|
|
309
|
+
else:
|
|
310
|
+
return dfs
|
|
311
|
+
|
|
300
312
|
# SHARES
|
|
301
313
|
|
|
302
314
|
def share(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Iterator, Optional
|
|
1
|
+
from typing import Any, Iterator, Optional, List, Dict
|
|
2
2
|
|
|
3
3
|
from mostlyai.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
4
4
|
from mostlyai.model import Connector
|
|
@@ -91,3 +91,9 @@ class _MostlyConnectorsClient(_MostlyBaseClient, _MostlySharesMixin):
|
|
|
91
91
|
verb=GET, path=[connector_id, "locations"], params={"prefix": prefix}
|
|
92
92
|
)
|
|
93
93
|
return response
|
|
94
|
+
|
|
95
|
+
def _schema(self, connector_id: str, location: str) -> List[Dict[str, Any]]:
|
|
96
|
+
response = self.request(
|
|
97
|
+
verb=GET, path=[connector_id, "schema"], params={"location": location}
|
|
98
|
+
)
|
|
99
|
+
return response
|
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from mostlyai.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
7
7
|
from mostlyai.model import Generator, JobProgress
|
|
8
8
|
from mostlyai.shares import _MostlySharesMixin
|
|
9
|
-
from mostlyai.utils import
|
|
9
|
+
from mostlyai.utils import _convert_to_base64, _job_wait, _read_table_from_path
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
|
|
@@ -61,12 +61,12 @@ class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
|
|
|
61
61
|
if "data" in table and table["data"] is not None:
|
|
62
62
|
if isinstance(table["data"], (str, Path)):
|
|
63
63
|
name, df = _read_table_from_path(table["data"])
|
|
64
|
-
table["data"] =
|
|
64
|
+
table["data"] = _convert_to_base64(df)
|
|
65
65
|
if "name" not in table:
|
|
66
66
|
table["name"] = name
|
|
67
67
|
del df
|
|
68
68
|
elif isinstance(table["data"], pd.DataFrame):
|
|
69
|
-
table["data"] =
|
|
69
|
+
table["data"] = _convert_to_base64(table["data"])
|
|
70
70
|
else:
|
|
71
71
|
raise ValueError("data must be a DataFrame or a file path")
|
|
72
72
|
|
|
@@ -108,7 +108,9 @@ class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
|
|
|
108
108
|
)
|
|
109
109
|
return response
|
|
110
110
|
|
|
111
|
-
def _training_wait(
|
|
112
|
-
|
|
111
|
+
def _training_wait(
|
|
112
|
+
self, generator_id: str, progress_bar: bool, interval: float
|
|
113
|
+
) -> Generator:
|
|
114
|
+
_job_wait(lambda: self._training_progress(generator_id), interval, progress_bar)
|
|
113
115
|
generator = self.get(generator_id)
|
|
114
116
|
return generator
|