Update app.py
Browse files
app.py
CHANGED
|
@@ -60,19 +60,17 @@ tum_unlu_verileri = {
|
|
| 60 |
# --- ARAYÜZ AYARLARI ---
|
| 61 |
st.set_page_config(page_title="CastMatch AI", layout="wide")
|
| 62 |
|
| 63 |
-
#
|
| 64 |
st.markdown("""
|
| 65 |
<style>
|
| 66 |
-
/* Resim konteynırını sabitle */
|
| 67 |
[data-testid="stImage"] {
|
| 68 |
min-height: 400px !important;
|
| 69 |
max-height: 400px !important;
|
| 70 |
-
background-color: transparent;
|
| 71 |
display: flex;
|
| 72 |
align-items: center;
|
| 73 |
justify-content: center;
|
|
|
|
| 74 |
}
|
| 75 |
-
/* Resmi çerçeveye sığdır */
|
| 76 |
.stImage img {
|
| 77 |
max-height: 400px !important;
|
| 78 |
width: auto !important;
|
|
@@ -86,7 +84,7 @@ st.sidebar.title("🔍 Control Panel / Kontrol Paneli")
|
|
| 86 |
st.sidebar.markdown("---")
|
| 87 |
gender_choice = st.sidebar.radio("1. Select Category / Kategori Seçin:", ["Male / Erkek", "Female / Kadın"])
|
| 88 |
|
| 89 |
-
# Hugging Face ana
|
| 90 |
ana_dizin_dosyalari = os.listdir(".")
|
| 91 |
filtered_names = [name for name in tum_unlu_verileri.keys() if tum_unlu_verileri[name]['c'] == gender_choice]
|
| 92 |
|
|
@@ -104,7 +102,6 @@ with col_actor:
|
|
| 104 |
st.subheader("👤 Pick an Actor / Oyuncu Seç")
|
| 105 |
selected_actor = st.selectbox("Select from list / Seçiniz:", ["Choose..."] + filtered_names)
|
| 106 |
|
| 107 |
-
# Resim Alanı
|
| 108 |
if selected_actor != "Choose...":
|
| 109 |
found_path = None
|
| 110 |
target_underscore = selected_actor.replace(" ", "_").lower()
|
|
@@ -122,8 +119,8 @@ with col_actor:
|
|
| 122 |
else:
|
| 123 |
st.error(f"Image not found! / Resim bulunamadı: {selected_actor}")
|
| 124 |
else:
|
| 125 |
-
#
|
| 126 |
-
st.markdown('<div style="height: 400px;
|
| 127 |
|
| 128 |
with col_match:
|
| 129 |
st.subheader("🎯 Best Career Matches / En İyi Kariyer Eşleşmeleri")
|
|
@@ -134,7 +131,6 @@ with col_match:
|
|
| 134 |
results = []
|
| 135 |
for i in movie_dict:
|
| 136 |
dist = spatial.distance.cosine(actor_v, movie_dict[i][1][:6])
|
| 137 |
-
# Skor Hatası Düzeltmesi
|
| 138 |
dist = max(0, min(1, dist))
|
| 139 |
results.append((movie_dict[i][0], dist))
|
| 140 |
|
|
@@ -144,7 +140,8 @@ with col_match:
|
|
| 144 |
st.success(f"**{i}. {film}** (%{pct})")
|
| 145 |
st.progress(pct / 100)
|
| 146 |
else:
|
| 147 |
-
st.error("Model file missing!
|
| 148 |
|
|
|
|
| 149 |
st.markdown("---")
|
| 150 |
-
st.info("
|
|
|
|
| 60 |
# --- ARAYÜZ AYARLARI ---
|
| 61 |
st.set_page_config(page_title="CastMatch AI", layout="wide")
|
| 62 |
|
| 63 |
+
# CSS: Resim alanını sabitle ve tasarımı temizle
|
| 64 |
st.markdown("""
|
| 65 |
<style>
|
|
|
|
| 66 |
[data-testid="stImage"] {
|
| 67 |
min-height: 400px !important;
|
| 68 |
max-height: 400px !important;
|
|
|
|
| 69 |
display: flex;
|
| 70 |
align-items: center;
|
| 71 |
justify-content: center;
|
| 72 |
+
background-color: transparent;
|
| 73 |
}
|
|
|
|
| 74 |
.stImage img {
|
| 75 |
max-height: 400px !important;
|
| 76 |
width: auto !important;
|
|
|
|
| 84 |
st.sidebar.markdown("---")
|
| 85 |
gender_choice = st.sidebar.radio("1. Select Category / Kategori Seçin:", ["Male / Erkek", "Female / Kadın"])
|
| 86 |
|
| 87 |
+
# Hugging Face ana dizinindeki dosyaları listele
|
| 88 |
ana_dizin_dosyalari = os.listdir(".")
|
| 89 |
filtered_names = [name for name in tum_unlu_verileri.keys() if tum_unlu_verileri[name]['c'] == gender_choice]
|
| 90 |
|
|
|
|
| 102 |
st.subheader("👤 Pick an Actor / Oyuncu Seç")
|
| 103 |
selected_actor = st.selectbox("Select from list / Seçiniz:", ["Choose..."] + filtered_names)
|
| 104 |
|
|
|
|
| 105 |
if selected_actor != "Choose...":
|
| 106 |
found_path = None
|
| 107 |
target_underscore = selected_actor.replace(" ", "_").lower()
|
|
|
|
| 119 |
else:
|
| 120 |
st.error(f"Image not found! / Resim bulunamadı: {selected_actor}")
|
| 121 |
else:
|
| 122 |
+
# Çizgisiz temiz boşluk alanı
|
| 123 |
+
st.markdown('<div style="height: 400px; display: flex; align-items: center; justify-content: center; color: #999; font-style: italic;">Select an actor to view profile</div>', unsafe_allow_html=True)
|
| 124 |
|
| 125 |
with col_match:
|
| 126 |
st.subheader("🎯 Best Career Matches / En İyi Kariyer Eşleşmeleri")
|
|
|
|
| 131 |
results = []
|
| 132 |
for i in movie_dict:
|
| 133 |
dist = spatial.distance.cosine(actor_v, movie_dict[i][1][:6])
|
|
|
|
| 134 |
dist = max(0, min(1, dist))
|
| 135 |
results.append((movie_dict[i][0], dist))
|
| 136 |
|
|
|
|
| 140 |
st.success(f"**{i}. {film}** (%{pct})")
|
| 141 |
st.progress(pct / 100)
|
| 142 |
else:
|
| 143 |
+
st.error("Model file missing!")
|
| 144 |
|
| 145 |
+
# --- ALT BİLGİ ---
|
| 146 |
st.markdown("---")
|
| 147 |
+
st.info("**How it works? / Nasıl çalışır?**: This AI analyzes career vectors based on available local assets. / Bu yapay zeka, mevcut yerel varlıklara (resimlere) dayanarak kariyer vektörlerini analiz eder.")
|