Shru commited on
Commit
7cfd799
Β·
1 Parent(s): bad301d

major changes

Browse files
Files changed (1) hide show
  1. pages/Teachable_Machine_Model.py +17 -19
pages/Teachable_Machine_Model.py CHANGED
@@ -74,35 +74,33 @@ else:
74
  confidence_score = prediction[0][index]
75
 
76
  # Print prediction and confidence score
77
- result = f"Your plant is suffering from: {class_name[2:]}"
78
- result_score = f"βœ… Accurate prediction score is: `{confidence_score}/ 100`"
79
- st.success(result)
80
- st.info(result_score)
 
 
 
 
81
  st.write("""
82
  Get to know more about this disease and management strategies to prevent them from spreading.
83
- *Just copy the disease name predicted above & paste it in the input box as it is!*
 
84
  """)
85
 
86
  # Loading diseases info & management strategies
87
  df = pd.read_csv('pages/Disease_solutions.csv')
88
- disease = st.text_input('Enter the disease name below πŸ‘‡', ' ') # to avoid valuError
89
- about = []
90
- strategies = []
91
-
92
- # selecting rows based on condition
93
- type_df = df.loc[df['Diseases'] == disease, 'Type'].item()
94
- des_df = df.loc[df['Diseases'] == disease, 'Description'].item()
95
- about.append(des_df)
96
 
97
- sol = df.loc[df['Diseases'] == disease, 'Management Strategies'].item()
98
- strategies.append(sol)
 
99
 
100
  # Print diseases' other info
101
  tab1, tab2 = st.tabs(["πŸ‘€ Description", "⭐ Solution"])
102
 
103
  with tab1:
104
- st.write("Disease Type: ", type_df)
105
- st.markdown(f"About this disease:\n\n {about[0]}")
106
-
107
  with tab2:
108
- st.markdown(f"### Steps that can help solve this disease:\n\n {strategies[0]}")
 
74
  confidence_score = prediction[0][index]
75
 
76
  # Print prediction and confidence score
77
+ result_score = "βœ… Accurate prediction score is: {} / 100".format("%.2f" % confidence_score)
78
+ if class_name[2:] == 'Healthy plant':
79
+ st.sucess("Don't worry! Your plant is healthy πŸ‘")
80
+ st.info(result_score)
81
+ else:
82
+ result = f"Your plant is suffering from: {class_name[2:]}"
83
+ st.success(result)
84
+ st.info(result_score)
85
  st.write("""
86
  Get to know more about this disease and management strategies to prevent them from spreading.
87
+
88
+ *Just copy the disease name predicted above & paste it in the input box as it is!*
89
  """)
90
 
91
  # Loading diseases info & management strategies
92
  df = pd.read_csv('pages/Disease_solutions.csv')
93
+ disease = st.text_input('Enter the disease name below πŸ‘‡', ' ')
 
 
 
 
 
 
 
94
 
95
+ # Selecting rows based on condition
96
+ about = df.loc[df['Diseases'] == disease, ['Type', 'Description']]
97
+ strategies = df.loc[df['Diseases'] == disease, 'Management Strategies']
98
 
99
  # Print diseases' other info
100
  tab1, tab2 = st.tabs(["πŸ‘€ Description", "⭐ Solution"])
101
 
102
  with tab1:
103
+ st.dataframe(about, hide_index=True, use_container_width=True)
104
+
 
105
  with tab2:
106
+ st.dataframe(strategies, hide_index=True, use_container_width=True)