HarunDemircioglu11 commited on
Commit
be97bec
·
verified ·
1 Parent(s): 23be820

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +10 -3
src/streamlit_app.py CHANGED
@@ -1,10 +1,19 @@
1
  import streamlit as st
2
  import pickle
3
  import numpy as np
 
4
 
5
  st.title('Kişilik Özelliklerine Göre Tahmin Modeli :bust_in_silhouette:')
6
 
7
- with open('behv.pkl', 'rb') as file:
 
 
 
 
 
 
 
 
8
  model, feature_names = pickle.load(file)
9
 
10
  st.header("Aşağıdaki alanları doldurun:")
@@ -37,5 +46,3 @@ if st.button('Tahmin Et'):
37
  except Exception:
38
  result = f"Bilinmeyen sonuç: {output}"
39
  st.success(f"Tahmin sonucu: {result}")
40
-
41
-
 
1
  import streamlit as st
2
  import pickle
3
  import numpy as np
4
+ import os
5
 
6
  st.title('Kişilik Özelliklerine Göre Tahmin Modeli :bust_in_silhouette:')
7
 
8
+ MODEL_PATH = "src/behv.pkl" # src klasörü içindeki dosya yolu
9
+
10
+ # Dosya var mı kontrol et
11
+ if not os.path.isfile(MODEL_PATH):
12
+ st.error(f"Model dosyası '{MODEL_PATH}' bulunamadı! Klasördeki dosyalar: {os.listdir('src')}")
13
+ st.stop()
14
+
15
+ # Dosyayı yükle
16
+ with open(MODEL_PATH, 'rb') as file:
17
  model, feature_names = pickle.load(file)
18
 
19
  st.header("Aşağıdaki alanları doldurun:")
 
46
  except Exception:
47
  result = f"Bilinmeyen sonuç: {output}"
48
  st.success(f"Tahmin sonucu: {result}")