Spaces:
Sleeping
Sleeping
import pickle as pk | |
import pandas as pd | |
import streamlit as st | |
# Load the trained model | |
model = pk.load(open("data.pkl", "rb")) | |
# Define a function to predict user data | |
def predict_user_data(user_data): | |
user_df = pd.DataFrame(user_data, index=[0]) | |
user_df = extract_features(user_df) # Assuming the extract_features function is defined elsewhere in your code | |
prediction = model.predict(user_df)[0] | |
return prediction | |
# Streamlit app layout | |
st.title("Fake or Genuine User Classifier") | |
# Get user input | |
user_statuses_count = st.number_input("Statuses Count", min_value=0) | |
user_followers_count = st.number_input("Followers Count", min_value=0) | |
user_friends_count = st.number_input("Friends Count", min_value=0) | |
user_favourites_count = st.number_input("Favourites Count", min_value=0) | |
user_listed_count = st.number_input("Listed Count", min_value=0) | |
user_name = st.text_input("Name") | |
# Get user input as a dictionary | |
user_data = { | |
"statuses_count": user_statuses_count, | |
"followers_count": user_followers_count, | |
"friends_count": user_friends_count, | |
"favourites_count": user_favourites_count, | |
"listed_count": user_listed_count, | |
"name": user_name, | |
} | |
# Predict if the user clicks the button | |
if st.button("Classify User"): | |
prediction = predict_user_data(user_data) | |
if prediction == 1: | |
st.success("The user is likely Genuine.") | |
else: | |
st.warning("The user is likely Fake.") | |