Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -175,19 +175,19 @@ if uploaded_img is not None or image_to_analyze_path is not None:
|
|
| 175 |
|
| 176 |
with col1:
|
| 177 |
if uploaded_img is not None:
|
| 178 |
-
st.image(uploaded_img,
|
| 179 |
img_name = uploaded_img.name
|
| 180 |
img_bytes = uploaded_img.getvalue()
|
| 181 |
img_type = uploaded_img.type
|
| 182 |
else:
|
| 183 |
with open(image_to_analyze_path, "rb") as f:
|
| 184 |
img_bytes = f.read()
|
| 185 |
-
st.image(img_bytes,
|
| 186 |
img_name = os.path.basename(image_to_analyze_path)
|
| 187 |
img_type = "image/jpeg" if img_name.lower().endswith(('.jpg', '.jpeg')) else "image/png"
|
| 188 |
|
| 189 |
with col2:
|
| 190 |
-
if st.button("Identifica Ingredienti", type="primary",
|
| 191 |
with st.spinner("Analisi dell'immagine in corso..."):
|
| 192 |
files = {"image": (img_name, img_bytes, img_type)}
|
| 193 |
data = {"client_id": CLIENT_ID}
|
|
|
|
| 175 |
|
| 176 |
with col1:
|
| 177 |
if uploaded_img is not None:
|
| 178 |
+
st.image(uploaded_img, width='stretch')
|
| 179 |
img_name = uploaded_img.name
|
| 180 |
img_bytes = uploaded_img.getvalue()
|
| 181 |
img_type = uploaded_img.type
|
| 182 |
else:
|
| 183 |
with open(image_to_analyze_path, "rb") as f:
|
| 184 |
img_bytes = f.read()
|
| 185 |
+
st.image(img_bytes, width='stretch')
|
| 186 |
img_name = os.path.basename(image_to_analyze_path)
|
| 187 |
img_type = "image/jpeg" if img_name.lower().endswith(('.jpg', '.jpeg')) else "image/png"
|
| 188 |
|
| 189 |
with col2:
|
| 190 |
+
if st.button("Identifica Ingredienti", type="primary", width='stretch'):
|
| 191 |
with st.spinner("Analisi dell'immagine in corso..."):
|
| 192 |
files = {"image": (img_name, img_bytes, img_type)}
|
| 193 |
data = {"client_id": CLIENT_ID}
|