JohanBeytell commited on
Commit
9cce94e
·
verified ·
1 Parent(s): 711f0eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -2
app.py CHANGED
@@ -72,12 +72,65 @@ def predict_mushroom(*inputs):
72
  # Return the human-readable result
73
  return 'Edible' if prediction[0] == 0 else 'Poisonous'
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  demo = gr.Interface(
76
  fn=predict_mushroom,
77
  inputs=[gr.Dropdown(choices=list(options.values()), label=feature) for feature, options in feature_options.items()],
78
- outputs="text",
79
  title="MycoNom - Mushroom Edibility Classifier",
80
- 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."
 
81
  )
82
 
83
  demo.launch()
 
72
  # Return the human-readable result
73
  return 'Edible' if prediction[0] == 0 else 'Poisonous'
74
 
75
+ # Example 1: Death cap mushroom (poisonous)
76
+ death_cap_example = [
77
+ "convex", # cap-shape ('x')
78
+ "smooth", # cap-surface ('s')
79
+ "green", # cap-color ('r') – assuming 'green' is in our options for cap-color
80
+ "bruises", # bruises ('t')
81
+ "none", # odor ('n')
82
+ "free", # gill-attachment ('f')
83
+ "distant", # gill-spacing ('d')
84
+ "narrow", # gill-size ('n')
85
+ "white", # gill-color ('w')
86
+ "tapering", # stalk-shape ('t')
87
+ "cup", # stalk-root ('u')
88
+ "smooth", # stalk-surface-above-ring ('s')
89
+ "smooth", # stalk-surface-below-ring ('s')
90
+ "white", # stalk-color-above-ring ('w')
91
+ "white", # stalk-color-below-ring ('w')
92
+ "universal", # veil-type ('u')
93
+ "white", # veil-color ('w')
94
+ "one", # ring-number ('o')
95
+ "evanescent", # ring-type ('e')
96
+ "white", # spore-print-color ('w')
97
+ "scattered", # population ('s')
98
+ "woods" # habitat ('d')
99
+ ]
100
+
101
+ # Example 2: Normal brown edible mushroom
102
+ edible_example = [
103
+ "bell", # cap-shape ('b')
104
+ "fibrous", # cap-surface ('f')
105
+ "brown", # cap-color ('n')
106
+ "no", # bruises ('f')
107
+ "almond", # odor ('a')
108
+ "attached", # gill-attachment ('a')
109
+ "close", # gill-spacing ('c')
110
+ "broad", # gill-size ('b')
111
+ "brown", # gill-color ('n')
112
+ "enlarging", # stalk-shape ('e')
113
+ "bulbous", # stalk-root ('b')
114
+ "fibrous", # stalk-surface-above-ring ('f')
115
+ "fibrous", # stalk-surface-below-ring ('f')
116
+ "brown", # stalk-color-above-ring ('n')
117
+ "brown", # stalk-color-below-ring ('n')
118
+ "partial", # veil-type ('p')
119
+ "brown", # veil-color ('n')
120
+ "none", # ring-number ('n')
121
+ "none", # ring-type ('n')
122
+ "brown", # spore-print-color ('n')
123
+ "numerous", # population ('n')
124
+ "meadows" # habitat ('m')
125
+ ]
126
+
127
  demo = gr.Interface(
128
  fn=predict_mushroom,
129
  inputs=[gr.Dropdown(choices=list(options.values()), label=feature) for feature, options in feature_options.items()],
130
+ outputs=gr.Textbox(label="Prediction"),
131
  title="MycoNom - Mushroom Edibility Classifier",
132
+ 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.",
133
+ examples=[death_cap_example, edible_example]
134
  )
135
 
136
  demo.launch()