Update src/streamlit_app.py
Browse files- src/streamlit_app.py +1 -16
src/streamlit_app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import streamlit as st
|
2 |
-
import requests
|
3 |
from PIL import Image
|
4 |
|
5 |
st.image("src/RezbinLogo.jpg", width=150)
|
@@ -9,20 +8,6 @@ st.write("Upload an image of your waste before throwing it.")
|
|
9 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
|
10 |
|
11 |
if uploaded_file is not None:
|
12 |
-
# Show preview
|
13 |
img = Image.open(uploaded_file)
|
14 |
st.image(img, caption="Uploaded Image", use_container_width=True)
|
15 |
-
|
16 |
-
# Send to AI API
|
17 |
-
files = {"file": uploaded_file.getvalue()}
|
18 |
-
try:
|
19 |
-
response = requests.post("https://your-api-url.com/predict", files=files)
|
20 |
-
if response.status_code == 200:
|
21 |
-
result = response.json()
|
22 |
-
label = result.get("label", "Unknown item")
|
23 |
-
reward = result.get("reward", 0)
|
24 |
-
st.markdown(f'<div class="orange-background">This is a {label}. You earn {reward:.2f}</div>', unsafe_allow_html=True)
|
25 |
-
else:
|
26 |
-
st.error(f"Error: {response.status_code} - {response.text}")
|
27 |
-
except Exception as e:
|
28 |
-
st.error(f"Failed to connect to model: {e}")
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from PIL import Image
|
3 |
|
4 |
st.image("src/RezbinLogo.jpg", width=150)
|
|
|
8 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
|
9 |
|
10 |
if uploaded_file is not None:
|
|
|
11 |
img = Image.open(uploaded_file)
|
12 |
st.image(img, caption="Uploaded Image", use_container_width=True)
|
13 |
+
st.markdown('<div style="background-color: orange; padding: 10px; border-radius: 5px;">This is a can. You earn 0.50</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|