gustproof commited on
Commit
1cc1d5e
·
verified ·
1 Parent(s): c05ccb6

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -5
src/streamlit_app.py CHANGED
@@ -124,7 +124,7 @@ col1, col2 = st.columns(2)
124
 
125
  with col1:
126
  st.header("Upload Image")
127
- uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
128
 
129
  if uploaded_file is not None:
130
  # Read the image bytes
@@ -133,11 +133,11 @@ with col1:
133
  try:
134
  image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
135
  image = NativeResize(14, (270, 301))(image)
136
- st.info(f"Resied (width, height): {image.size}")
137
- st.image(image, caption="Uploaded Image.")
138
  except Exception as e:
139
  st.error(f"Error opening image: {e}")
140
- st.warning("Please upload a valid image file (JPG, JPEG, PNG).")
141
  uploaded_file = None # Reset uploaded_file so processing stops
142
 
143
  with col2:
@@ -158,7 +158,7 @@ with col2:
158
  df = pd.DataFrame(
159
  [
160
  (i, tags[ti][0], f"{p:.4f}", get_category(ti), tags[ti][1])
161
- for i, (ti, p) in enumerate(filtered_results[:150], 1)
162
  ],
163
  columns=[
164
  "Rank",
 
124
 
125
  with col1:
126
  st.header("Upload Image")
127
+ uploaded_file = st.file_uploader("Choose an image...")
128
 
129
  if uploaded_file is not None:
130
  # Read the image bytes
 
133
  try:
134
  image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
135
  image = NativeResize(14, (270, 301))(image)
136
+ w, h = image.size
137
+ st.image(image, caption=f"Resized: {w}x{h}")
138
  except Exception as e:
139
  st.error(f"Error opening image: {e}")
140
+ st.warning("Please upload a valid image file")
141
  uploaded_file = None # Reset uploaded_file so processing stops
142
 
143
  with col2:
 
158
  df = pd.DataFrame(
159
  [
160
  (i, tags[ti][0], f"{p:.4f}", get_category(ti), tags[ti][1])
161
+ for i, (ti, p) in enumerate(filtered_results[:200], 1)
162
  ],
163
  columns=[
164
  "Rank",