Spaces:
Sleeping
Sleeping
ryantrisnadi
commited on
Commit
•
7f99c17
1
Parent(s):
a9b5b03
Update prediction.py
Browse files- prediction.py +30 -16
prediction.py
CHANGED
@@ -5,17 +5,31 @@ import pickle
|
|
5 |
def run():
|
6 |
# Load All Files
|
7 |
|
8 |
-
|
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 = [
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
37 |
-
|
38 |
-
|
39 |
-
# st.markdown("[Cara Cegah Serangan Jantung](https://www.siloamhospitals.com/informasi-siloam/artikel/cara-cegah-serangan-jantung-di-usia-muda)")
|
40 |
|
41 |
-
#
|
42 |
-
|
43 |
-
|
|
|
|
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)
|