Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,53 +5,53 @@ import streamlit as st
|
|
| 5 |
model = joblib.load('model_tree.joblib')
|
| 6 |
unique_values = joblib.load('unique_values.joblib')
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
unique_bruises = unique_values["bruises"]
|
| 12 |
unique_odor = unique_values["odor"]
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
unique_veil_type = unique_values["veil-type"]
|
| 24 |
-
|
| 25 |
-
|
| 26 |
unique_ring_type = unique_values["ring-type"]
|
| 27 |
-
|
| 28 |
unique_population = unique_values["population"]
|
| 29 |
unique_habitat = unique_values["habitat"]
|
| 30 |
|
| 31 |
def main():
|
| 32 |
st.title("Is this mushroom eatable")
|
| 33 |
with st.form("questionaire"):
|
| 34 |
-
cap_shape = st.selectbox("cap shape",option =
|
| 35 |
-
cap_surface = st.selectbox("cap surface",option =
|
| 36 |
-
|
| 37 |
bruises = st.selectbox("bruises",option = unique_bruises)
|
| 38 |
odor = st.selectbox("odor",option = unique_odor)
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
veil_type = st.selectbox("veil type",option = unique_veil_type)
|
| 51 |
-
|
| 52 |
-
|
| 53 |
ring_type = st.selectbox("ring type",option = unique_ring_type)
|
| 54 |
-
|
| 55 |
population = st.selectbox("population",option = unique_population)
|
| 56 |
habitat = st.selectbox("habitat",option= unique_habitat)
|
| 57 |
|
|
@@ -59,7 +59,7 @@ def main():
|
|
| 59 |
|
| 60 |
clicked = st.form_submit_button("Predict income")
|
| 61 |
if clicked:
|
| 62 |
-
result=model.predict(pd.DataFrame({'cap-shape':[cap_shape],'cap-surface':[cap_surface],'cap-color':[
|
| 63 |
# Show prediction
|
| 64 |
result = 'eatable' if result[0]==1 else 'poisonous'
|
| 65 |
st.success("This Mushroom is "+result)
|
|
|
|
| 5 |
model = joblib.load('model_tree.joblib')
|
| 6 |
unique_values = joblib.load('unique_values.joblib')
|
| 7 |
|
| 8 |
+
unique_cap_shape = unique_values["cap-shape"]
|
| 9 |
+
unique_cap_surface = unique_values["cap-surface"]
|
| 10 |
+
unique_cap_color = unique_values["cap-color"]
|
| 11 |
unique_bruises = unique_values["bruises"]
|
| 12 |
unique_odor = unique_values["odor"]
|
| 13 |
+
unique_gill_attachment = unique_values["gill-attachment"]
|
| 14 |
+
unique_gill_spacing = unique_values["gill-spacing"]
|
| 15 |
+
unique_gill_size = unique_values["gill-size"]
|
| 16 |
+
unique_gill_color = unique_values['gill-color']
|
| 17 |
+
unique_stalk_shape = unique_values["stalk-shape"]
|
| 18 |
+
unique_stalk_root = unique_values["stalk-root"]
|
| 19 |
+
unique_stalk_surface_above_ring = unique_values["stalk-surface-above-ring"]
|
| 20 |
+
unique_stalk_surface_below_ring = unique_values["stalk-surface-below-ring"]
|
| 21 |
+
unique_stalk_color_above_ring = unique_values["stalk-color-above-ring"]
|
| 22 |
+
unique_stalk_color_below_ring = unique_values["stalk-color-below-ring"]
|
| 23 |
unique_veil_type = unique_values["veil-type"]
|
| 24 |
+
unique_veil_color = unique_values['veil-color']
|
| 25 |
+
unique_ring_number = unique_values["ring-number"]
|
| 26 |
unique_ring_type = unique_values["ring-type"]
|
| 27 |
+
unique_spore_print_color = unique_values["spore-print-color"]
|
| 28 |
unique_population = unique_values["population"]
|
| 29 |
unique_habitat = unique_values["habitat"]
|
| 30 |
|
| 31 |
def main():
|
| 32 |
st.title("Is this mushroom eatable")
|
| 33 |
with st.form("questionaire"):
|
| 34 |
+
cap_shape = st.selectbox("cap shape",option = unique_cap_shape)
|
| 35 |
+
cap_surface = st.selectbox("cap surface",option = unique_cap_surface)
|
| 36 |
+
cap_color = st.selectbox("cap color",option = unique_cap_color)
|
| 37 |
bruises = st.selectbox("bruises",option = unique_bruises)
|
| 38 |
odor = st.selectbox("odor",option = unique_odor)
|
| 39 |
+
gill_attachment = st.selectbox("gill attachment",option = unique_gill_attachment)
|
| 40 |
+
gill_spacing = st.selectbox("gill spacing",option = unique_gill_spacing)
|
| 41 |
+
gill_size = st.selectbox("gill size",option = unique_gill_size)
|
| 42 |
+
gill_color = st.selectbox("gill color",option = unique_gill_color)
|
| 43 |
+
stalk_shape = st.selectbox("stalk shape",option = unique_stalk_shape)
|
| 44 |
+
stalk_shape = st.selectbox("stalk shape",option = unique_stalk_shape)
|
| 45 |
+
stalk_root = st.selectbox("stalk root",option = unique_stalk_root)
|
| 46 |
+
stalk_surface_above_ring = st.selectbox("stalk surface above ring",option = unique_stalk_surface_above_ring)
|
| 47 |
+
stalk_surface_below_ring = st.selectbox("stalk surface below ring",option = unique_stalk_surface_below_ring)
|
| 48 |
+
stalk_color_above_ring = st.selectbox("stalk color above ring",option = unique_stalk_color_above_ring)
|
| 49 |
+
stalk_color_below_ring = st.selectbox("stalk color below ring",option = unique_stalk_color_below_ring)
|
| 50 |
veil_type = st.selectbox("veil type",option = unique_veil_type)
|
| 51 |
+
veil_color = st.selectbox("veil color",option = unique_veil_color)
|
| 52 |
+
ring_number = st.selectbox("ring number",option = unique_ring_number)
|
| 53 |
ring_type = st.selectbox("ring type",option = unique_ring_type)
|
| 54 |
+
spore_print_color = st.selectbox("spore print color",option = unique_unique_spore_print_color)
|
| 55 |
population = st.selectbox("population",option = unique_population)
|
| 56 |
habitat = st.selectbox("habitat",option= unique_habitat)
|
| 57 |
|
|
|
|
| 59 |
|
| 60 |
clicked = st.form_submit_button("Predict income")
|
| 61 |
if clicked:
|
| 62 |
+
result=model.predict(pd.DataFrame({'cap-shape':[cap_shape],'cap-surface':[cap_surface],'cap-color':[cap_color], 'bruises':[bruises], 'odor':[odor], 'gill-attachment':[gill_attachment], 'gill-spacing':[gill_spacing], 'gill-size':[gill_size], 'gill-color':[gill_color], 'stalk-shape':[stalk_shape], 'stalk-root':[stalk_root], 'stalk-surface-above-ring':[stalk_surface_above_ring], 'stalk-surface-below-ring':[stalk_surface_below_ring], 'stalk-color-above-ring':[stalk_color_above_ring], 'stalk-color-below-ring':[stalk_color_below_ring], 'veil-type':[veil_type], 'veil-color':[veil_color], 'ring-number':[ring_number], 'ring-type':[ring_type], 'spore-print-color':[spore_print_color], 'population':[population], 'habitat':[habitat]}))
|
| 63 |
# Show prediction
|
| 64 |
result = 'eatable' if result[0]==1 else 'poisonous'
|
| 65 |
st.success("This Mushroom is "+result)
|