AkashKumarPS/fake-profile-detector
0
1import gradio as gr2import pickle3import numpy as np4 5# Load trained model6model = pickle.load(open("fake_profile_model.pkl", "rb"))7 8def predict(profile_pic, username_length, fullname_words,9 fullname_length, name_equals_username,10 description_length, external_url, private,11 posts, followers, following):12 13 features = np.array([[profile_pic, username_length, fullname_words,14 fullname_length, name_equals_username,15 description_length, external_url, private,16 posts, followers, following]])17 18 prediction = model.predict(features)19 20 if prediction[0] == 1:21 return "⚠️ Fake Profile"22 else:23 return "✅ Genuine Profile"24 25 26interface = gr.Interface(27 fn=predict,28 inputs=[29 gr.Number(label="Profile Picture (0 or 1)"),30 gr.Number(label="Username Length"),31 gr.Number(label="Full Name Words"),32 gr.Number(label="Full Name Length"),33 gr.Number(label="Name Equals Username (0 or 1)"),34 gr.Number(label="Description Length"),35 gr.Number(label="External URL (0 or 1)"),36 gr.Number(label="Private Account (0 or 1)"),37 gr.Number(label="Number of Posts"),38 gr.Number(label="Followers"),39 gr.Number(label="Following")40 ],41 outputs=gr.Textbox(label="Prediction"),42 title="Fake Social Media Profile Detector",43 description="Enter profile features to detect whether an account is fake or genuine."44)45 46interface.launch(server_name="0.0.0.0", server_port=7860)