Spaces:
Build error
Build error
Update pages/1_Clothing_Bias.py
Browse files- pages/1_Clothing_Bias.py +5 -4
pages/1_Clothing_Bias.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
import requests
|
| 4 |
from io import BytesIO
|
|
@@ -16,7 +17,7 @@ def load_clip_model():
|
|
| 16 |
return model, processor
|
| 17 |
|
| 18 |
# --- Main page content ---
|
| 19 |
-
st.header("
|
| 20 |
st.markdown("""
|
| 21 |
This application explores biases in scene classification models related to clothing attributes.
|
| 22 |
It leverages the CLIP model to analyze and highlight these biases.
|
|
@@ -50,8 +51,8 @@ elif input_method == "Default Images":
|
|
| 50 |
col = columns[i % 4]
|
| 51 |
img_path = os.path.join(image_dir, image_file)
|
| 52 |
with col:
|
| 53 |
-
st.image(img_path, caption=image_file,
|
| 54 |
-
if st.button(f"Select {
|
| 55 |
selected_image = image_file
|
| 56 |
|
| 57 |
# Store selected image using session state so selection persists
|
|
@@ -69,7 +70,7 @@ if image is not None:
|
|
| 69 |
|
| 70 |
# Prompt input
|
| 71 |
st.subheader("π Candidate Scene Labels")
|
| 72 |
-
default_prompts = ["a business executive", "a festival participant"]
|
| 73 |
prompts_text = st.text_area("Enter one label per line:", "\n".join(default_prompts))
|
| 74 |
labels = [label.strip() for label in prompts_text.strip().split("\n") if label.strip()]
|
| 75 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import string as s
|
| 3 |
from PIL import Image
|
| 4 |
import requests
|
| 5 |
from io import BytesIO
|
|
|
|
| 17 |
return model, processor
|
| 18 |
|
| 19 |
# --- Main page content ---
|
| 20 |
+
st.header("Clothing Bias in Scene Classification")
|
| 21 |
st.markdown("""
|
| 22 |
This application explores biases in scene classification models related to clothing attributes.
|
| 23 |
It leverages the CLIP model to analyze and highlight these biases.
|
|
|
|
| 51 |
col = columns[i % 4]
|
| 52 |
img_path = os.path.join(image_dir, image_file)
|
| 53 |
with col:
|
| 54 |
+
st.image(img_path, caption=image_file, use_container_width=True)
|
| 55 |
+
if st.button(f"Select {s.ascii_uppercase[i]}", key=image_file):
|
| 56 |
selected_image = image_file
|
| 57 |
|
| 58 |
# Store selected image using session state so selection persists
|
|
|
|
| 70 |
|
| 71 |
# Prompt input
|
| 72 |
st.subheader("π Candidate Scene Labels")
|
| 73 |
+
default_prompts = ["a business executive", "a festival participant", "a indian maid", "a school teacher"]
|
| 74 |
prompts_text = st.text_area("Enter one label per line:", "\n".join(default_prompts))
|
| 75 |
labels = [label.strip() for label in prompts_text.strip().split("\n") if label.strip()]
|
| 76 |
|