Update app.py
Browse files
app.py
CHANGED
|
@@ -88,29 +88,27 @@ with col_actor:
|
|
| 88 |
selected_actor = st.selectbox("Select from list / Listeden seçin:", filtered_names if filtered_names else ["Yok"])
|
| 89 |
|
| 90 |
if selected_actor != "Yok":
|
| 91 |
-
#
|
| 92 |
-
|
| 93 |
-
base_path = os.path.dirname(__file__) if "__file__" in locals() else os.getcwd()
|
| 94 |
-
resim_klasoru = os.path.join(base_path, "40 resim")
|
| 95 |
-
|
| 96 |
found_path = None
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
| 107 |
break
|
| 108 |
|
| 109 |
if found_path:
|
| 110 |
st.image(found_path, caption=f"Profile: {selected_actor}", use_container_width=True)
|
| 111 |
else:
|
| 112 |
-
st.warning(f"⚠️ Resim dosyası
|
| 113 |
-
st.info("İpucu:
|
| 114 |
|
| 115 |
with col_match:
|
| 116 |
st.subheader("🎯 Best Career Matches / En İyi Kariyer Eşleşmeleri")
|
|
@@ -133,7 +131,7 @@ with col_match:
|
|
| 133 |
st.write(f"Match Score / Uyum Skoru: **%{pct}**")
|
| 134 |
st.progress(pct / 100)
|
| 135 |
else:
|
| 136 |
-
st.error("Model dosyası eksik! /
|
| 137 |
|
| 138 |
st.markdown("---")
|
| 139 |
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.")
|
|
|
|
| 88 |
selected_actor = st.selectbox("Select from list / Listeden seçin:", filtered_names if filtered_names else ["Yok"])
|
| 89 |
|
| 90 |
if selected_actor != "Yok":
|
| 91 |
+
# DOSYA BULUCU (HUGGING FACE ANA DİZİNİ İÇİN)
|
| 92 |
+
ana_dizin = os.getcwd()
|
|
|
|
|
|
|
|
|
|
| 93 |
found_path = None
|
| 94 |
+
|
| 95 |
+
# Arama stratejisi: Dosya adında ismin geçip geçmediğine bakıyoruz
|
| 96 |
+
search_term = selected_actor.lower().replace(" ", "_") # Robert_De_Niro gibi
|
| 97 |
+
search_term_plain = selected_actor.lower() # Robert De Niro gibi
|
| 98 |
+
|
| 99 |
+
for f in os.listdir(ana_dizin):
|
| 100 |
+
f_lower = f.lower()
|
| 101 |
+
# Eğer dosya bir resimse ve oyuncu ismini içeriyorsa
|
| 102 |
+
if f_lower.endswith(('.jpg', '.png', '.jpeg')):
|
| 103 |
+
if search_term in f_lower or search_term_plain in f_lower:
|
| 104 |
+
found_path = os.path.join(ana_dizin, f)
|
| 105 |
break
|
| 106 |
|
| 107 |
if found_path:
|
| 108 |
st.image(found_path, caption=f"Profile: {selected_actor}", use_container_width=True)
|
| 109 |
else:
|
| 110 |
+
st.warning(f"⚠️ Resim dosyası bulunamadı: {selected_actor}")
|
| 111 |
+
st.info("İpucu: Hugging Face'e yüklediğiniz resim ismiyle listedeki isim eşleşmelidir.")
|
| 112 |
|
| 113 |
with col_match:
|
| 114 |
st.subheader("🎯 Best Career Matches / En İyi Kariyer Eşleşmeleri")
|
|
|
|
| 131 |
st.write(f"Match Score / Uyum Skoru: **%{pct}**")
|
| 132 |
st.progress(pct / 100)
|
| 133 |
else:
|
| 134 |
+
st.error("Model dosyası eksik! / movie_model.pkl dosyası bulunamadı!")
|
| 135 |
|
| 136 |
st.markdown("---")
|
| 137 |
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.")
|