Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,23 +26,41 @@ except Exception as e:
|
|
| 26 |
st.stop()
|
| 27 |
|
| 28 |
# ==========================================
|
| 29 |
-
# 3.
|
| 30 |
# ==========================================
|
| 31 |
-
st.sidebar.header("
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
selected_mood = st.sidebar.selectbox("Mood/Lighting", all_moods)
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# ==========================================
|
| 43 |
# 4. FILTERING LOGIC (Connecting to Dataset)
|
| 44 |
# ==========================================
|
| 45 |
-
results = df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
if selected_angle != "Any":
|
| 47 |
results = results[results['camera_angle'] == selected_angle]
|
| 48 |
if selected_mood != "Any":
|
|
@@ -50,21 +68,10 @@ if selected_mood != "Any":
|
|
| 50 |
if selected_emotion != "Any":
|
| 51 |
results = results[results['emotion'] == selected_emotion]
|
| 52 |
|
| 53 |
-
# ---
|
| 54 |
base_url = "https://huggingface.co/datasets/Roshanurs/Horror-Reference-Data/resolve/main/Panels_Out"
|
| 55 |
|
| 56 |
-
|
| 57 |
-
for idx, row in results.iterrows():
|
| 58 |
-
# This constructs the direct link to the image in your 24 batch folders
|
| 59 |
-
img_url = f"{base_url}/{row['filename']}"
|
| 60 |
-
valid_images.append({
|
| 61 |
-
"url": img_url,
|
| 62 |
-
"filename": row['filename'],
|
| 63 |
-
"desc": row['description']
|
| 64 |
-
})
|
| 65 |
-
|
| 66 |
-
st.markdown(f"**Found {len(valid_images)} matching shots**")
|
| 67 |
-
st.write("---")
|
| 68 |
|
| 69 |
# ==========================================
|
| 70 |
# 5. THE MASONRY GALLERY
|
|
|
|
| 26 |
st.stop()
|
| 27 |
|
| 28 |
# ==========================================
|
| 29 |
+
# 3. SHOTDECK-STYLE SEARCH & FILTERS
|
| 30 |
# ==========================================
|
| 31 |
+
st.sidebar.header("🔍 Search Library")
|
| 32 |
|
| 33 |
+
# 1. The Global Text Search Bar
|
| 34 |
+
search_query = st.sidebar.text_input("Keyword Search", placeholder="e.g., monster, shadow, running...")
|
| 35 |
+
st.sidebar.write("---")
|
| 36 |
|
| 37 |
+
st.sidebar.header("📂 Filter Categories")
|
|
|
|
| 38 |
|
| 39 |
+
# 2. Expandable Category: Camera
|
| 40 |
+
with st.sidebar.expander("🎥 Camera & Framing"):
|
| 41 |
+
all_angles = ["Any"] + sorted(df['camera_angle'].dropna().unique().tolist())
|
| 42 |
+
selected_angle = st.selectbox("Camera Angle", all_angles)
|
| 43 |
+
|
| 44 |
+
# 3. Expandable Category: Mood & Emotion
|
| 45 |
+
with st.sidebar.expander("🎭 Mood & Character"):
|
| 46 |
+
all_moods = ["Any"] + sorted(df['mood'].dropna().unique().tolist())
|
| 47 |
+
selected_mood = st.selectbox("Lighting/Mood", all_moods)
|
| 48 |
+
|
| 49 |
+
all_emotions = ["Any"] + sorted(df['emotion'].dropna().unique().tolist())
|
| 50 |
+
selected_emotion = st.selectbox("Character Emotion", all_emotions)
|
| 51 |
+
|
| 52 |
+
# Add more expanders here later if you add things like "Time of Day" or "Location"!
|
| 53 |
|
| 54 |
# ==========================================
|
| 55 |
# 4. FILTERING LOGIC (Connecting to Dataset)
|
| 56 |
# ==========================================
|
| 57 |
+
results = df.copy()
|
| 58 |
+
|
| 59 |
+
# Apply the text search (searches the AI description column)
|
| 60 |
+
if search_query:
|
| 61 |
+
results = results[results['description'].str.contains(search_query, case=False, na=False)]
|
| 62 |
+
|
| 63 |
+
# Apply the dropdown filters
|
| 64 |
if selected_angle != "Any":
|
| 65 |
results = results[results['camera_angle'] == selected_angle]
|
| 66 |
if selected_mood != "Any":
|
|
|
|
| 68 |
if selected_emotion != "Any":
|
| 69 |
results = results[results['emotion'] == selected_emotion]
|
| 70 |
|
| 71 |
+
# --- KEEP YOUR EXISTING URL CONSTRUCTOR BELOW THIS ---
|
| 72 |
base_url = "https://huggingface.co/datasets/Roshanurs/Horror-Reference-Data/resolve/main/Panels_Out"
|
| 73 |
|
| 74 |
+
# ... (The rest of your code stays exactly the same!)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
# ==========================================
|
| 77 |
# 5. THE MASONRY GALLERY
|