ESMATUGBA commited on
Commit
ad33872
·
verified ·
1 Parent(s): e411c54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
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
- # RESİM BULMA MOTORU (GELİŞMİŞ)
92
- # Klasör adını ve yolunu daha sağlam tanımlıyoruz
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
- if os.path.exists(resim_klasoru):
98
- dosyalar = os.listdir(resim_klasoru)
99
- # Arama stratejisi: Küçük harf yap, boşlukları alt tire yap veya olduğu gibi ara
100
- search_name = selected_actor.lower()
101
- search_underscore = selected_actor.lower().replace(" ", "_")
102
-
103
- for f in dosyalar:
104
- f_lower = f.lower()
105
- if search_underscore in f_lower or search_name in f_lower:
106
- found_path = os.path.join(resim_klasoru, f)
 
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ı '40 resim' klasöründe bulunamadı: {selected_actor}")
113
- st.info("İpucu: Dosya adının oyuncu ismiyle (Örn: sylvester_stallone.jpg) aynı olduğundan emin olun.")
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! / Model file missing!")
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.")