Spaces:
Runtime error
Runtime error
major changes
Browse files- 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 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
st.write("""
|
| 82 |
Get to know more about this disease and management strategies to prevent them from spreading.
|
| 83 |
-
|
|
|
|
| 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 π', ' ')
|
| 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 |
-
|
| 98 |
-
|
|
|
|
| 99 |
|
| 100 |
# Print diseases' other info
|
| 101 |
tab1, tab2 = st.tabs(["π Description", "β Solution"])
|
| 102 |
|
| 103 |
with tab1:
|
| 104 |
-
st.
|
| 105 |
-
|
| 106 |
-
|
| 107 |
with tab2:
|
| 108 |
-
|
|
|
|
| 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)
|