Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,12 +43,14 @@ def predict_mushroom(*inputs):
|
|
| 43 |
features = list(feature_options.keys())
|
| 44 |
user_input = dict(zip(features, inputs))
|
| 45 |
|
| 46 |
-
# Convert string inputs to
|
| 47 |
numerical_features = {}
|
| 48 |
for feature, value in user_input.items():
|
| 49 |
if feature in mappings:
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
else:
|
| 53 |
raise ValueError(f"Invalid value '{value}' for feature '{feature}'.")
|
| 54 |
else:
|
|
@@ -71,7 +73,7 @@ demo = gr.Interface(
|
|
| 71 |
inputs=[gr.Dropdown(choices=list(options.values()), label=feature) for feature, options in feature_options.items()],
|
| 72 |
outputs="text",
|
| 73 |
title="MycoNom - Mushroom Edibility Classifier",
|
| 74 |
-
description="Select the mushroom features to determine if it's edible or poisonous.<br><br>**Disclaimer:** This model is for **educational purposes only** and should not be used for real-life mushroom classification or any decision-making processes related to the consumption of mushrooms. While the model performs well on the provided dataset, it has not been thoroughly validated for real-world scenarios and may not accurately detect poisonous mushrooms in all conditions. Always consult an expert or use trusted resources when identifying mushrooms."
|
| 75 |
)
|
| 76 |
|
| 77 |
demo.launch()
|
|
|
|
| 43 |
features = list(feature_options.keys())
|
| 44 |
user_input = dict(zip(features, inputs))
|
| 45 |
|
| 46 |
+
# Convert the string inputs (full names) directly to corresponding letters using the mappings
|
| 47 |
numerical_features = {}
|
| 48 |
for feature, value in user_input.items():
|
| 49 |
if feature in mappings:
|
| 50 |
+
# Reverse the mapping to find the corresponding letter
|
| 51 |
+
inverse_mapping = {v: k for k, v in mappings[feature].items()}
|
| 52 |
+
if value in inverse_mapping:
|
| 53 |
+
numerical_features[feature] = inverse_mapping[value] # Map full name to letter
|
| 54 |
else:
|
| 55 |
raise ValueError(f"Invalid value '{value}' for feature '{feature}'.")
|
| 56 |
else:
|
|
|
|
| 73 |
inputs=[gr.Dropdown(choices=list(options.values()), label=feature) for feature, options in feature_options.items()],
|
| 74 |
outputs="text",
|
| 75 |
title="MycoNom - Mushroom Edibility Classifier",
|
| 76 |
+
description="Select the mushroom features to determine if it's edible or poisonous.<br><br>You can train your own version of this model by heading to OPEN-ARC: https://github.com/Infinitode/OPEN-ARC.<br><br>**Disclaimer:** This model is for **educational purposes only** and should not be used for real-life mushroom classification or any decision-making processes related to the consumption of mushrooms. While the model performs well on the provided dataset, it has not been thoroughly validated for real-world scenarios and may not accurately detect poisonous mushrooms in all conditions. Always consult an expert or use trusted resources when identifying mushrooms."
|
| 77 |
)
|
| 78 |
|
| 79 |
demo.launch()
|