File size: 1,414 Bytes
957a109
34f76c4
8720981
957a109
34f76c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
957a109
 
 
34f76c4
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pickle
import pandas as pd
import streamlit as st

# Load the trained model
model = pickle.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.")