Upload 3 files
Browse files- README.md +49 -3
- classifier.pkl +3 -0
- fpd1.py +39 -0
README.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Fake Profile Detection
|
2 |
+
# 🚨 Fake Instagram Profile Detection using Machine Learning
|
3 |
+
|
4 |
+
This project is a real-time Instagram profile analyzer that predicts whether a given profile is **fake** or **real** using machine learning. It uses profile metrics like follower count, following count, post count, and verification status to make predictions.
|
5 |
+
|
6 |
+
---
|
7 |
+
|
8 |
+
## 📌 How It Works
|
9 |
+
|
10 |
+
- You enter an Instagram **username**.
|
11 |
+
- The application uses the **Apify API** to fetch public profile data.
|
12 |
+
- It extracts key features such as:
|
13 |
+
- Number of followers
|
14 |
+
- Number of followings
|
15 |
+
- Number of posts
|
16 |
+
- Is the account private?
|
17 |
+
- Is the account verified?
|
18 |
+
- These features are passed into a pre-trained **machine learning model** (`classifier.pkl`) to predict whether the profile is real or fake.
|
19 |
+
|
20 |
+
---
|
21 |
+
|
22 |
+
## 🛠 Technologies Used
|
23 |
+
|
24 |
+
- **Python**
|
25 |
+
- **Streamlit** – for building the web app
|
26 |
+
- **Joblib** – for loading the ML model
|
27 |
+
- **Apify API** – to scrape Instagram data
|
28 |
+
- **Scikit-learn** – for training the ML model
|
29 |
+
- **Pandas, NumPy** – for data manipulation
|
30 |
+
|
31 |
+
---
|
32 |
+
|
33 |
+
## 🧠 ML Model
|
34 |
+
|
35 |
+
The model is trained using a labeled dataset containing Instagram profile attributes. The classification is binary:
|
36 |
+
- `0` → Likely Fake
|
37 |
+
- `1` → Likely Real
|
38 |
+
|
39 |
+
The training includes feature normalization and multiple algorithm trials like Logistic Regression, Decision Trees, and Random Forests. The final deployed model is chosen based on accuracy and generalization.
|
40 |
+
|
41 |
+
---
|
42 |
+
|
43 |
+
## 🖥️ Project UI
|
44 |
+
|
45 |
+
- The app is built with **Streamlit** for a clean and interactive interface.
|
46 |
+
- Users simply input a **username** and click **Predict**.
|
47 |
+
- Output shows the profile’s stats and the prediction result with appropriate messaging (Success/Error).
|
48 |
+
|
49 |
+
---
|
classifier.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b2ad437a3a0a74a8f793b60926ac67c57912c9a4bc08d9cb480e99cc8662d09
|
3 |
+
size 413195
|
fpd1.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
import joblib
|
5 |
+
from apify_client import ApifyClient
|
6 |
+
model = joblib.load("classifier.pkl")
|
7 |
+
client = ApifyClient("apify_api_nscRkHOyMh3mytIWftXpHpZlIzBhgF4mZyPV")
|
8 |
+
st.title("Fake Instagram Profile Detection")
|
9 |
+
st.write("Plaese provide instagram account details you would like to predict")
|
10 |
+
n = st.text_input("Enter username ")
|
11 |
+
run_input = { "usernames": [n] }
|
12 |
+
run = client.actor("dSCLg0C3YEZ83HzYX").call(run_input=run_input)
|
13 |
+
m = client.dataset(run["defaultDatasetId"])
|
14 |
+
for item in m.iterate_items():
|
15 |
+
postsCount= item.get('postsCount')
|
16 |
+
followersCount = item.get('followersCount')
|
17 |
+
followsCount = item.get('followsCount')
|
18 |
+
private=item.get('private')
|
19 |
+
verified=item.get('verified')
|
20 |
+
|
21 |
+
def predictor(postsCount,followersCount,followsCount,private,verified):
|
22 |
+
prediction = model.predict([[postsCount,followersCount,followsCount,private,verified]])
|
23 |
+
print(prediction)
|
24 |
+
return prediction
|
25 |
+
|
26 |
+
|
27 |
+
if st.button("Predict"):
|
28 |
+
result = predictor(postsCount,followersCount,followsCount,private,verified)
|
29 |
+
st.write("The number of posts : " , postsCount)
|
30 |
+
st.write("The number of followers : " ,followersCount)
|
31 |
+
st.write("The number of following : " ,followsCount)
|
32 |
+
st.write("Private : " ,private)
|
33 |
+
st.write("Verified : " ,verified)
|
34 |
+
if postsCount == None:
|
35 |
+
st.error("The User Doesn't exist")
|
36 |
+
elif result == 0 and postsCount != None:
|
37 |
+
st.error("The Account is Likely to be Fake ")
|
38 |
+
else:
|
39 |
+
st.success("The Account is Likely to be Real")
|