Deployment / prediction.py
ryantrisnadi's picture
Update prediction.py
7f99c17 verified
raw
history blame contribute delete
No virus
2 kB
import streamlit as st
import pandas as pd
import pickle
def run():
# Load All Files
file_path = "https://drive.google.com/file/d/1iAlO-jScEJBa4_RaNGR7G_-xaUKKECGz/view?usp=sharing"
df_original = pd.read_csv(file_path)
index_columns = [
"The film was good and had a great story.",
"This movie is like nothing I've seen before.",
"One of the best films I've seen in a long time.",
"Would definitely recommend this great movie.",
"The story in this film is captivating.",
"I would see this movie again.",
"A good time watching this film.",
"Great performances make this movie memorable.",
"The film's plot was like no other.",
"Time well spent watching this great film.",
"This movie was really bad.",
"I wouldn't watch this film again.",
"Even though it's a film, I didn't like it.",
"The movie was one of the worst I've seen.",
"Bad acting ruined the film for me.",
"I really disliked this movie.",
"Would not recommend this film to anyone.",
"The plot was confusing and not good.",
"Even though I like movies, this one was terrible.",
"Not a good use of time watching this movie."
]
df_data_dummy = df_original[index_columns].copy()
st.write('In the following is the result of the data you have input : ')
print(df_data_dummy.head())
st.table(df_data_dummy)
if st.button(label='predict'):
# Melakukan prediksi data dummy
y_pred_inf = full_process.predict(df_data_dummy)
st.write('Client kemungkinan gagal bayar utang')
st.metric(label="Here is a prediction: ", value = y_pred_inf[0])
# Make predictions of IMDB dataset
predictions = loaded_lstm.predict(new_texts)
print('Predictions: ', predictions)
# Apply threshold for binary classification
threshold = 0.5
predicted_classes = (predictions > threshold).astype(int)
print('Predicted Classes: ', predicted_classes)