Spaces:
Sleeping
Sleeping
Joel Woodfield commited on
Commit ·
b43e0ab
1
Parent(s): dd6ed2e
Temporary set the minimum number of points to be 2
Browse files- backend/src/manager.py +8 -1
- frontends/gradio/main.py +1 -1
backend/src/manager.py
CHANGED
|
@@ -37,7 +37,7 @@ class Manager:
|
|
| 37 |
x2_col: int,
|
| 38 |
y_col: int,
|
| 39 |
) -> None:
|
| 40 |
-
|
| 41 |
dataset_type,
|
| 42 |
function,
|
| 43 |
x1_range_input,
|
|
@@ -52,6 +52,13 @@ class Manager:
|
|
| 52 |
y_col,
|
| 53 |
)
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
def _compute_dataset(
|
| 56 |
self,
|
| 57 |
dataset_type: str,
|
|
|
|
| 37 |
x2_col: int,
|
| 38 |
y_col: int,
|
| 39 |
) -> None:
|
| 40 |
+
dataset = self._compute_dataset(
|
| 41 |
dataset_type,
|
| 42 |
function,
|
| 43 |
x1_range_input,
|
|
|
|
| 52 |
y_col,
|
| 53 |
)
|
| 54 |
|
| 55 |
+
if len(dataset.x1) == 0:
|
| 56 |
+
raise ValueError("Dataset cannot be empty")
|
| 57 |
+
elif len(dataset.x1) == 1:
|
| 58 |
+
# todo - remove this condition after fixing weird cases
|
| 59 |
+
raise ValueError("Dataset must contain at least 2 points")
|
| 60 |
+
self.dataset = dataset
|
| 61 |
+
|
| 62 |
def _compute_dataset(
|
| 63 |
self,
|
| 64 |
dataset_type: str,
|
frontends/gradio/main.py
CHANGED
|
@@ -231,7 +231,7 @@ def launch():
|
|
| 231 |
label="Number of points",
|
| 232 |
value=default_num_points,
|
| 233 |
interactive=True,
|
| 234 |
-
minimum=
|
| 235 |
maximum=100,
|
| 236 |
step=1,
|
| 237 |
)
|
|
|
|
| 231 |
label="Number of points",
|
| 232 |
value=default_num_points,
|
| 233 |
interactive=True,
|
| 234 |
+
minimum=2, # todo - set to 1 after fixing weird cases
|
| 235 |
maximum=100,
|
| 236 |
step=1,
|
| 237 |
)
|