Update src/streamlit_app.py
Browse files12345678910111 unmodified line131415161718import streamlit as stfrom PIL import Imagest.image("src/RezbinLogo.jpg", width=150)st.title("Rezbin AI 📷")st.write("Upload an image of your waste before throwing it.")1 unmodified lineuploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])if uploaded_file is not None:img = Image.open(uploaded_file)st.image(img, caption="Uploaded Image", use_container_width=True)st.markdown('<div class="orange-background">This is a can. You earn 0.50</div>', unsafe_allow_html=True)12345671 unmodified line910111213141516171819202122232425262728import streamlit as stimport requestsfrom PIL import Imagest.image("src/RezbinLogo.jpg", width=150)st.title("Rezbin AI 📷")st.write("Upload an image of your waste before throwing it.")1 unmodified lineuploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])if uploaded_file is not None:# Show previewimg = Image.open(uploaded_file)st.image(img, caption="Uploaded Image", use_container_width=True)# Send to AI APIfiles = {"file": uploaded_file.getvalue()}try:response = requests.post("https://your-api-url.com/predict", files=files)if response.status_code == 200:result = response.json()label = result.get("label", "Unknown item")reward = result.get("reward", 0)st.markdown(f'<div class="orange-background">This is a {label}. You earn {reward:.2f}</div>', unsafe_allow_html=True)else:st.error(f"Error: {response.status_code} - {response.text}")except Exception as e:st.error(f"Failed to connect to model: {e}")
src/streamlit_app.py+16-6