Filimize commited on
Commit
831df81
·
1 Parent(s): f563cdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -34
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
- 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,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':[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)
 
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)