Update app.py
Browse files
app.py
CHANGED
|
@@ -79,6 +79,11 @@ def get_available_actors():
|
|
| 79 |
|
| 80 |
mevcut_isimler = get_available_actors()
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
# --- SIDEBAR ---
|
| 83 |
st.sidebar.title("🔍 Control Panel")
|
| 84 |
gender_choice = st.sidebar.radio("Category / Kategori:", ["Male / Erkek", "Female / Kadın"])
|
|
@@ -87,12 +92,23 @@ gender_choice = st.sidebar.radio("Category / Kategori:", ["Male / Erkek", "Femal
|
|
| 87 |
filtered_names = [n for n in mevcut_isimler if tum_unlu_verileri[n]['c'] == gender_choice]
|
| 88 |
|
| 89 |
st.sidebar.markdown("---")
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
"📋 Click to Select / Seçmek için Tıklayın:",
|
| 93 |
filtered_names,
|
| 94 |
-
index=
|
| 95 |
-
key="
|
|
|
|
| 96 |
)
|
| 97 |
|
| 98 |
# --- ANA EKRAN ---
|
|
@@ -104,16 +120,24 @@ col_actor, col_match = st.columns([1, 2])
|
|
| 104 |
with col_actor:
|
| 105 |
st.subheader("👤 Selected Actor / Seçili Oyuncu")
|
| 106 |
|
| 107 |
-
#
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
final_actor = st.selectbox(
|
| 111 |
"List / Liste:",
|
| 112 |
filtered_names,
|
| 113 |
-
index=
|
| 114 |
-
|
|
|
|
| 115 |
)
|
| 116 |
|
|
|
|
| 117 |
if final_actor:
|
| 118 |
found_path = None
|
| 119 |
target = final_actor.replace(" ", "_").lower()
|
|
@@ -143,7 +167,7 @@ with col_match:
|
|
| 143 |
st.success(f"**{i}. {film}**")
|
| 144 |
st.progress(pct / 100)
|
| 145 |
else:
|
| 146 |
-
st.write("Please select an actor
|
| 147 |
|
| 148 |
st.markdown("---")
|
| 149 |
-
st.info("💡 **
|
|
|
|
| 79 |
|
| 80 |
mevcut_isimler = get_available_actors()
|
| 81 |
|
| 82 |
+
# --- HAFIZA YÖNETİMİ ---
|
| 83 |
+
# Eğer hafızada bir oyuncu yoksa listenin ilk elemanını atayalım
|
| 84 |
+
if 'shared_actor' not in st.session_state:
|
| 85 |
+
st.session_state.shared_actor = mevcut_isimler[0] if mevcut_isimler else None
|
| 86 |
+
|
| 87 |
# --- SIDEBAR ---
|
| 88 |
st.sidebar.title("🔍 Control Panel")
|
| 89 |
gender_choice = st.sidebar.radio("Category / Kategori:", ["Male / Erkek", "Female / Kadın"])
|
|
|
|
| 92 |
filtered_names = [n for n in mevcut_isimler if tum_unlu_verileri[n]['c'] == gender_choice]
|
| 93 |
|
| 94 |
st.sidebar.markdown("---")
|
| 95 |
+
|
| 96 |
+
# SOL PANEL RADIO (Hafızaya bağlandı)
|
| 97 |
+
# Index'i her zaman hafızadaki isme göre bulur
|
| 98 |
+
try:
|
| 99 |
+
sidebar_idx = filtered_names.index(st.session_state.shared_actor)
|
| 100 |
+
except:
|
| 101 |
+
sidebar_idx = 0
|
| 102 |
+
|
| 103 |
+
def on_sidebar_change():
|
| 104 |
+
st.session_state.shared_actor = st.session_state.sidebar_key
|
| 105 |
+
|
| 106 |
+
st.sidebar.radio(
|
| 107 |
"📋 Click to Select / Seçmek için Tıklayın:",
|
| 108 |
filtered_names,
|
| 109 |
+
index=sidebar_idx,
|
| 110 |
+
key="sidebar_key",
|
| 111 |
+
on_change=on_sidebar_change
|
| 112 |
)
|
| 113 |
|
| 114 |
# --- ANA EKRAN ---
|
|
|
|
| 120 |
with col_actor:
|
| 121 |
st.subheader("👤 Selected Actor / Seçili Oyuncu")
|
| 122 |
|
| 123 |
+
# ORTA LİSTE SELECTBOX (Hafızaya bağlandı)
|
| 124 |
+
try:
|
| 125 |
+
main_idx = filtered_names.index(st.session_state.shared_actor)
|
| 126 |
+
except:
|
| 127 |
+
main_idx = 0
|
| 128 |
+
|
| 129 |
+
def on_main_change():
|
| 130 |
+
st.session_state.shared_actor = st.session_state.main_key
|
| 131 |
+
|
| 132 |
final_actor = st.selectbox(
|
| 133 |
"List / Liste:",
|
| 134 |
filtered_names,
|
| 135 |
+
index=main_idx,
|
| 136 |
+
key="main_key",
|
| 137 |
+
on_change=on_main_change
|
| 138 |
)
|
| 139 |
|
| 140 |
+
# RESİM GÖSTERME
|
| 141 |
if final_actor:
|
| 142 |
found_path = None
|
| 143 |
target = final_actor.replace(" ", "_").lower()
|
|
|
|
| 167 |
st.success(f"**{i}. {film}**")
|
| 168 |
st.progress(pct / 100)
|
| 169 |
else:
|
| 170 |
+
st.write("Please select an actor.")
|
| 171 |
|
| 172 |
st.markdown("---")
|
| 173 |
+
st.info("💡 **İpucu**: Sol taraftan veya orta listeden yaptığınız her seçim diğeriyle eşzamanlı değişir.")
|