Update app.py
Browse files
app.py
CHANGED
@@ -3,13 +3,13 @@ from transformers import pipeline
|
|
3 |
from PIL import Image
|
4 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
5 |
|
6 |
-
|
7 |
flower_pipeline = pipeline(task="image-classification", model="microsoft/resnet-50")
|
8 |
|
9 |
-
|
10 |
st.set_page_config(page_title="Flower Identifier ๐ธ", layout="wide", page_icon="๐ผ")
|
11 |
|
12 |
-
|
13 |
st.markdown(
|
14 |
"""
|
15 |
<div style="text-align: center; padding: 10px;">
|
@@ -20,7 +20,7 @@ st.markdown(
|
|
20 |
unsafe_allow_html=True
|
21 |
)
|
22 |
|
23 |
-
|
24 |
file_name = st.file_uploader("Upload a flower image ๐ธ", type=["jpg", "jpeg", "png"])
|
25 |
|
26 |
add_vertical_space(1)
|
@@ -28,7 +28,6 @@ add_vertical_space(1)
|
|
28 |
if file_name is not None:
|
29 |
col1, col2 = st.columns([1, 2])
|
30 |
|
31 |
-
# Display the uploaded image with shadow effect
|
32 |
image = Image.open(file_name)
|
33 |
col1.image(
|
34 |
image,
|
@@ -37,21 +36,21 @@ if file_name is not None:
|
|
37 |
output_format="auto"
|
38 |
)
|
39 |
|
40 |
-
|
41 |
predictions = flower_pipeline(image)
|
42 |
|
43 |
col2.markdown("### ๐บ Predictions & Confidence Levels")
|
44 |
|
45 |
for p in predictions:
|
46 |
col2.write(f"**{p['label']}**")
|
47 |
-
col2.progress(p["score"])
|
|
|
48 |
|
49 |
-
# Footer
|
50 |
st.markdown(
|
51 |
"""
|
52 |
<hr style="border-top: 3px solid #40916C;">
|
53 |
<div style="text-align: center;">
|
54 |
-
<p style="color: #1B4332;">Powered by
|
55 |
</div>
|
56 |
""",
|
57 |
unsafe_allow_html=True
|
|
|
3 |
from PIL import Image
|
4 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
5 |
|
6 |
+
|
7 |
flower_pipeline = pipeline(task="image-classification", model="microsoft/resnet-50")
|
8 |
|
9 |
+
|
10 |
st.set_page_config(page_title="Flower Identifier ๐ธ", layout="wide", page_icon="๐ผ")
|
11 |
|
12 |
+
|
13 |
st.markdown(
|
14 |
"""
|
15 |
<div style="text-align: center; padding: 10px;">
|
|
|
20 |
unsafe_allow_html=True
|
21 |
)
|
22 |
|
23 |
+
|
24 |
file_name = st.file_uploader("Upload a flower image ๐ธ", type=["jpg", "jpeg", "png"])
|
25 |
|
26 |
add_vertical_space(1)
|
|
|
28 |
if file_name is not None:
|
29 |
col1, col2 = st.columns([1, 2])
|
30 |
|
|
|
31 |
image = Image.open(file_name)
|
32 |
col1.image(
|
33 |
image,
|
|
|
36 |
output_format="auto"
|
37 |
)
|
38 |
|
39 |
+
|
40 |
predictions = flower_pipeline(image)
|
41 |
|
42 |
col2.markdown("### ๐บ Predictions & Confidence Levels")
|
43 |
|
44 |
for p in predictions:
|
45 |
col2.write(f"**{p['label']}**")
|
46 |
+
col2.progress(p["score"])
|
47 |
+
|
48 |
|
|
|
49 |
st.markdown(
|
50 |
"""
|
51 |
<hr style="border-top: 3px solid #40916C;">
|
52 |
<div style="text-align: center;">
|
53 |
+
<p style="color: #1B4332;">Powered by AgentsValley ๐ฟ</p>
|
54 |
</div>
|
55 |
""",
|
56 |
unsafe_allow_html=True
|