import streamlit as st
from transformers import pipeline
from PIL import Image
from streamlit_extras.add_vertical_space import add_vertical_space
flower_pipeline = pipeline(task="image-classification", model="microsoft/resnet-50")
st.set_page_config(page_title="Flower Identifier 🌸", layout="wide", page_icon="🌼")
st.markdown(
"""
Flower Identifier 🌸
Snap it, upload it, and identify the bloom!
""",
unsafe_allow_html=True
)
file_name = st.file_uploader("Upload a flower image 📸", type=["jpg", "jpeg", "png"])
add_vertical_space(1)
if file_name is not None:
col1, col2 = st.columns([1, 2])
image = Image.open(file_name)
col1.image(
image,
use_container_width=True,
caption="Uploaded Image",
output_format="auto"
)
predictions = flower_pipeline(image)
col2.markdown("### 🌺 Predictions & Confidence Levels")
for p in predictions:
col2.write(f"**{p['label']}**")
col2.progress(p["score"])
st.markdown(
"""
Powered by AgentsValley 🌿
""",
unsafe_allow_html=True
)