ryantrisnadi commited on
Commit
7f99c17
1 Parent(s): a9b5b03

Update prediction.py

Browse files
Files changed (1) hide show
  1. prediction.py +30 -16
prediction.py CHANGED
@@ -5,17 +5,31 @@ import pickle
5
  def run():
6
  # Load All Files
7
 
8
- with open('pipeline_model.pkl', 'rb') as file:
9
- full_process = pickle.load(file)
10
-
11
- file_path = "/Users/ryantrisnadi/Desktop/first_project1/p1-ftds017-hck-g5-ryantrisnadi/_P1G5_Set_1_Ryan_Trisnadi.csv"
12
  df_original = pd.read_csv(file_path)
13
 
14
- index_columns = ['limit_balance', 'sex', 'education_level', 'marital_status', 'age',
15
- 'pay_0', 'pay_2', 'pay_3', 'pay_4', 'pay_5', 'pay_6', 'bill_amt_1',
16
- 'bill_amt_2', 'bill_amt_3', 'bill_amt_4', 'bill_amt_5', 'bill_amt_6',
17
- 'pay_amt_1', 'pay_amt_2', 'pay_amt_3', 'pay_amt_4', 'pay_amt_5',
18
- 'pay_amt_6', 'default_payment_next_month']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  df_data_dummy = df_original[index_columns].copy()
20
 
21
  st.write('In the following is the result of the data you have input : ')
@@ -33,11 +47,11 @@ def run():
33
  st.write('Client kemungkinan gagal bayar utang')
34
  st.metric(label="Here is a prediction: ", value = y_pred_inf[0])
35
 
36
- # If your data is a classification, you can follow the example below
37
- # if y_pred_inf[0] == 0:
38
- # st.write('Pasien tidak terkena jantung')
39
- # st.markdown("[Cara Cegah Serangan Jantung](https://www.siloamhospitals.com/informasi-siloam/artikel/cara-cegah-serangan-jantung-di-usia-muda)")
40
 
41
- # else:
42
- # st.write('Pasien kemungkinan terkena jantung')
43
- # st.markdown("[Cara Hidup Sehat Sehabis Terkena Serangan Jantung](https://lifestyle.kompas.com/read/2021/11/09/101744620/7-pola-hidup-sehat-setelah-mengalami-serangan-jantung?page=all)")
 
 
5
  def run():
6
  # Load All Files
7
 
8
+ file_path = "https://drive.google.com/file/d/1iAlO-jScEJBa4_RaNGR7G_-xaUKKECGz/view?usp=sharing"
 
 
 
9
  df_original = pd.read_csv(file_path)
10
 
11
+ index_columns = [
12
+ "The film was good and had a great story.",
13
+ "This movie is like nothing I've seen before.",
14
+ "One of the best films I've seen in a long time.",
15
+ "Would definitely recommend this great movie.",
16
+ "The story in this film is captivating.",
17
+ "I would see this movie again.",
18
+ "A good time watching this film.",
19
+ "Great performances make this movie memorable.",
20
+ "The film's plot was like no other.",
21
+ "Time well spent watching this great film.",
22
+ "This movie was really bad.",
23
+ "I wouldn't watch this film again.",
24
+ "Even though it's a film, I didn't like it.",
25
+ "The movie was one of the worst I've seen.",
26
+ "Bad acting ruined the film for me.",
27
+ "I really disliked this movie.",
28
+ "Would not recommend this film to anyone.",
29
+ "The plot was confusing and not good.",
30
+ "Even though I like movies, this one was terrible.",
31
+ "Not a good use of time watching this movie."
32
+ ]
33
  df_data_dummy = df_original[index_columns].copy()
34
 
35
  st.write('In the following is the result of the data you have input : ')
 
47
  st.write('Client kemungkinan gagal bayar utang')
48
  st.metric(label="Here is a prediction: ", value = y_pred_inf[0])
49
 
50
+ # Make predictions of IMDB dataset
51
+ predictions = loaded_lstm.predict(new_texts)
52
+ print('Predictions: ', predictions)
 
53
 
54
+ # Apply threshold for binary classification
55
+ threshold = 0.5
56
+ predicted_classes = (predictions > threshold).astype(int)
57
+ print('Predicted Classes: ', predicted_classes)