File size: 1,543 Bytes
c2ce559 e369950 |
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 |
import numpy as np
import pandas as pd
import streamlit as st
import joblib
from apify_client import ApifyClient
model = joblib.load("classifier.pkl")
client = ApifyClient("your api key from apify")
st.title("Fake Instagram Profile Detection")
st.write("Plaese provide instagram account details you would like to predict")
n = st.text_input("Enter username ")
run_input = { "usernames": [n] }
run = client.actor("dSCLg0C3YEZ83HzYX").call(run_input=run_input)
m = client.dataset(run["defaultDatasetId"])
for item in m.iterate_items():
postsCount= item.get('postsCount')
followersCount = item.get('followersCount')
followsCount = item.get('followsCount')
private=item.get('private')
verified=item.get('verified')
def predictor(postsCount,followersCount,followsCount,private,verified):
prediction = model.predict([[postsCount,followersCount,followsCount,private,verified]])
print(prediction)
return prediction
if st.button("Predict"):
result = predictor(postsCount,followersCount,followsCount,private,verified)
st.write("The number of posts : " , postsCount)
st.write("The number of followers : " ,followersCount)
st.write("The number of following : " ,followsCount)
st.write("Private : " ,private)
st.write("Verified : " ,verified)
if postsCount == None:
st.error("The User Doesn't exist")
elif result == 0 and postsCount != None:
st.error("The Account is Likely to be Fake ")
else:
st.success("The Account is Likely to be Real") |