Haticece commited on
Commit
cd0d2c7
·
verified ·
1 Parent(s): 8cfe684

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
4
  from sklearn.preprocessing import OneHotEncoder
5
  from sklearn.impute import SimpleImputer
6
 
7
- # Modeli, encoder'ı ve imputer'ı yükleme
8
  logreg_model = joblib.load('logreg_model.pkl')
9
  rf_model = joblib.load('rf_model.pkl')
10
  encoder = joblib.load('encoder.pkl')
@@ -59,8 +59,24 @@ def fraud_detection(accountAgeDays, numItems, localTime, paymentMethod, paymentM
59
  rf_prediction = rf_model.predict(input_data)[0]
60
 
61
  # Sonuçları formatlama
62
- logreg_result = "Sahtekarlık Değil" if logreg_prediction == 0 else "Sahtekarlık"
63
- rf_result = "Sahtekarlık Değil" if rf_prediction == 0 else "Sahtekarlık"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  return f"Logistic Regression: {logreg_result}\nRandom Forest: {rf_result}"
66
 
 
4
  from sklearn.preprocessing import OneHotEncoder
5
  from sklearn.impute import SimpleImputer
6
 
7
+ # Modeli, encoder'ı ve imputer'ı yükleme - IMPORT'lardan HEMEN SONRA
8
  logreg_model = joblib.load('logreg_model.pkl')
9
  rf_model = joblib.load('rf_model.pkl')
10
  encoder = joblib.load('encoder.pkl')
 
59
  rf_prediction = rf_model.predict(input_data)[0]
60
 
61
  # Sonuçları formatlama
62
+ logreg_result = "
63
+
64
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67044b086fd3c9b6f6576f6d/Yk1ALS0QO0s48XbPO1Y_A.png)
65
+
66
+ " if logreg_prediction == 0 else "
67
+
68
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67044b086fd3c9b6f6576f6d/kn7rSJLyehM0BRq-BLGmf.png)
69
+
70
+ "
71
+ rf_result = "
72
+
73
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67044b086fd3c9b6f6576f6d/Wpa8dOnc9l1H-sz_U1YHy.png)
74
+
75
+ " if rf_prediction == 0 else "
76
+
77
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67044b086fd3c9b6f6576f6d/-P8PGOa8GqW9cC0gM5fWj.png)
78
+
79
+ "
80
 
81
  return f"Logistic Regression: {logreg_result}\nRandom Forest: {rf_result}"
82