Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -358,31 +358,30 @@ def predict_inverse(antimicrobial_activity_target, substrate, microorganism, num
|
|
358 |
domain = []
|
359 |
for column in targets:
|
360 |
df_columns.remove(column)
|
|
|
361 |
constrained_columns = ['Substrate', 'Washing_cycles', 'Microorganism ']
|
362 |
-
|
363 |
-
### Add input
|
364 |
-
for
|
365 |
-
if
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
elif
|
378 |
-
domain.append({'name': str(
|
|
|
|
|
379 |
else:
|
380 |
-
|
381 |
-
|
382 |
-
if c.startswith(not_c) and not_c not in seen_not_constrained:
|
383 |
-
domain.append({'name': str(not_c), 'type': 'categorical', 'domain': (0,1),
|
384 |
-
'dimensionality': dimensionality_dict[not_c]})
|
385 |
-
seen_not_constrained.append(str(not_c))
|
386 |
print("Domain is ", domain)
|
387 |
print(len(domain))
|
388 |
|
|
|
358 |
domain = []
|
359 |
for column in targets:
|
360 |
df_columns.remove(column)
|
361 |
+
|
362 |
constrained_columns = ['Substrate', 'Washing_cycles', 'Microorganism ']
|
363 |
+
|
364 |
+
### Add input domain
|
365 |
+
for df_column in df_columns:
|
366 |
+
if df_column == "Substrate":
|
367 |
+
for one_hot_column in one_hot_mapping[df_column]:
|
368 |
+
if one_hot_column == substrate:
|
369 |
+
domain.append({'name': str(one_hot_column), 'type': 'categorical', 'domain': (1.0, 1.0)})
|
370 |
+
else:
|
371 |
+
domain.append({'name': str(one_hot_column), 'type': 'categorical', 'domain': (0.0, 0.0)})
|
372 |
+
elif df_column == 'Microorganism ':
|
373 |
+
for one_hot_column in one_hot_mapping[df_column]:
|
374 |
+
if one_hot_column == microorganism:
|
375 |
+
domain.append({'name': str(one_hot_column), 'type': 'categorical', 'domain': (1.0, 1.0)})
|
376 |
+
else:
|
377 |
+
domain.append({'name': str(one_hot_column), 'type': 'categorical', 'domain': (0.0, 0.0)})
|
378 |
+
elif df_column == 'Washing_cycles':
|
379 |
+
domain.append({'name': str(df_column), 'type': 'categorical', 'domain': (int(num_washing_cycles), int(num_washing_cycles))})
|
380 |
+
elif df_column in numerical_columns:
|
381 |
+
domain.append({'name': str(df_column), 'type': 'continuous', 'domain': (0.,1.)})
|
382 |
else:
|
383 |
+
domain.append({'name': str(df_column), 'type': 'categorical', 'domain': (0,1),
|
384 |
+
'dimensionality': dimensionality_dict[df_column]})
|
|
|
|
|
|
|
|
|
385 |
print("Domain is ", domain)
|
386 |
print(len(domain))
|
387 |
|