Update app.py
Browse files
app.py
CHANGED
@@ -221,6 +221,8 @@ usefulness = {
|
|
221 |
# Add the usefulness or importance for the rest of the flowers
|
222 |
}
|
223 |
|
|
|
|
|
224 |
# Function to add a background image
|
225 |
def add_bg_from_local(image_path):
|
226 |
with open(image_path, "rb") as image_file:
|
@@ -306,8 +308,8 @@ def main():
|
|
306 |
<h4 style="color:white"> LEVEL:</br> <b>400L</b></h4>
|
307 |
""", unsafe_allow_html=True)
|
308 |
|
309 |
-
elif selected == "
|
310 |
-
st.markdown('<h1 style="color:white;">
|
311 |
st.markdown('<h3 style="color:white;">This is a demo of an image classification model trained on the Oxford Flower Dataset.</h3>', unsafe_allow_html=True)
|
312 |
st.markdown('<h3 style="color:white;">To test the model, upload an image of a flower and click the Run on image button.</h3>', unsafe_allow_html=True)
|
313 |
|
@@ -317,18 +319,29 @@ def main():
|
|
317 |
result = st.button('Run on image')
|
318 |
|
319 |
if result and image is not None:
|
320 |
-
st.markdown('**_Calculating results..._**')
|
321 |
flower, closeness, botanical_name, flower_usefulness = predict(model, labels, image)
|
322 |
-
st.markdown(f'<h4 style="color:white;">Flower Type: <span style="color:
|
323 |
-
st.markdown(f'<h4 style="color:white;">Closeness: <span style="color:
|
324 |
-
st.markdown(f'<h4 style="color:white;">Botanical Name: <span style="color:
|
325 |
-
st.markdown(f'<h4 style="color:white;">Usefulness: <span style="color:orange;">{
|
326 |
|
327 |
-
elif selected == "
|
328 |
-
st.markdown('<h1 style="color:white;">
|
329 |
st.markdown('<h3 style="color:white;">This section will contain extensive classifier details and options.</h3>', unsafe_allow_html=True)
|
330 |
# Add your extensive classifier code here
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
elif selected == "Project Details":
|
333 |
st.markdown('<h1 style="color:white;">Project Details</h1>', unsafe_allow_html=True)
|
334 |
st.markdown("""
|
|
|
221 |
# Add the usefulness or importance for the rest of the flowers
|
222 |
}
|
223 |
|
224 |
+
useful = "Ornamental plant with colorful foliage and unique inflorescence"
|
225 |
+
|
226 |
# Function to add a background image
|
227 |
def add_bg_from_local(image_path):
|
228 |
with open(image_path, "rb") as image_file:
|
|
|
308 |
<h4 style="color:white"> LEVEL:</br> <b>400L</b></h4>
|
309 |
""", unsafe_allow_html=True)
|
310 |
|
311 |
+
elif selected == "Extensive Classifier":
|
312 |
+
st.markdown('<h1 style="color:white;">Extensive Classifier</h1>', unsafe_allow_html=True)
|
313 |
st.markdown('<h3 style="color:white;">This is a demo of an image classification model trained on the Oxford Flower Dataset.</h3>', unsafe_allow_html=True)
|
314 |
st.markdown('<h3 style="color:white;">To test the model, upload an image of a flower and click the Run on image button.</h3>', unsafe_allow_html=True)
|
315 |
|
|
|
319 |
result = st.button('Run on image')
|
320 |
|
321 |
if result and image is not None:
|
322 |
+
st.markdown('**_Calculating extensive results..._**')
|
323 |
flower, closeness, botanical_name, flower_usefulness = predict(model, labels, image)
|
324 |
+
st.markdown(f'<h4 style="color:white;">Flower Type: <span style="color:orange;">{flower}</span></h4>', unsafe_allow_html=True)
|
325 |
+
st.markdown(f'<h4 style="color:white;">Closeness: <span style="color:orange;">{closeness}%</span></h4>', unsafe_allow_html=True)
|
326 |
+
st.markdown(f'<h4 style="color:white;">Botanical Name: <span style="color:orange;">{botanical_name}</span></h4>', unsafe_allow_html=True)
|
327 |
+
st.markdown(f'<h4 style="color:white;">Usefulness: <span style="color:orange;">{useful}</span></h4>', unsafe_allow_html=True)
|
328 |
|
329 |
+
elif selected == "Local Classifier":
|
330 |
+
st.markdown('<h1 style="color:white;">Local Classifier</h1>', unsafe_allow_html=True)
|
331 |
st.markdown('<h3 style="color:white;">This section will contain extensive classifier details and options.</h3>', unsafe_allow_html=True)
|
332 |
# Add your extensive classifier code here
|
333 |
|
334 |
+
model = load_model()
|
335 |
+
labels = load_labels()
|
336 |
+
image = load_image()
|
337 |
+
result = st.button('Run on image')
|
338 |
+
|
339 |
+
if result and image is not None:
|
340 |
+
st.markdown('**_Calculating local results..._**')
|
341 |
+
flower, closeness, botanical_name, flower_usefulness = predict(model, labels, image)
|
342 |
+
st.markdown(f'<h5 style="color:white;">Flower Type: <span style="color:orange;">{flower}</span></h4>', unsafe_allow_html=True)
|
343 |
+
st.markdown(f'<h5 style="color:white;">Closeness: <span style="color:orange;">{closeness}%</span></h4>', unsafe_allow_html=True)
|
344 |
+
|
345 |
elif selected == "Project Details":
|
346 |
st.markdown('<h1 style="color:white;">Project Details</h1>', unsafe_allow_html=True)
|
347 |
st.markdown("""
|