Spaces:
Sleeping
Sleeping
Upload 14 files
Browse files- __pycache__/__init__.cpython-311.pyc +0 -0
- __pycache__/about.cpython-311.pyc +0 -0
- __pycache__/community.cpython-311.pyc +0 -0
- __pycache__/examples.cpython-311.pyc +0 -0
- __pycache__/home.cpython-311.pyc +0 -0
- __pycache__/install.cpython-311.pyc +0 -0
- __pycache__/user_guide.cpython-311.pyc +0 -0
- pages/about.py +43 -0
- pages/community.py +38 -0
- pages/dashboard.py +124 -0
- pages/examples.py +34 -0
- pages/home.py +123 -0
- pages/install.py +17 -0
- pages/user_guide.py +43 -0
__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (570 Bytes). View file
|
|
__pycache__/about.cpython-311.pyc
ADDED
Binary file (2.47 kB). View file
|
|
__pycache__/community.cpython-311.pyc
ADDED
Binary file (2.56 kB). View file
|
|
__pycache__/examples.cpython-311.pyc
ADDED
Binary file (2.31 kB). View file
|
|
__pycache__/home.cpython-311.pyc
ADDED
Binary file (7.09 kB). View file
|
|
__pycache__/install.cpython-311.pyc
ADDED
Binary file (1.13 kB). View file
|
|
__pycache__/user_guide.cpython-311.pyc
ADDED
Binary file (1.33 kB). View file
|
|
pages/about.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
import io
|
4 |
+
|
5 |
+
|
6 |
+
def show_about():
|
7 |
+
st.header(' ')
|
8 |
+
st.header(' ')
|
9 |
+
st.header(' ')
|
10 |
+
#st.header("API")
|
11 |
+
st.write("A deepfake is a type of synthetic media generated using deep learning techniques, particularly deep neural networks. The term ""deepfake"" is a combination of ""deep learning"" and ""fake.""")
|
12 |
+
st.write("In deepfake technology, algorithms are used to create or manipulate audio,\
|
13 |
+
video, or images to depict something that did not actually occur or that alters the appearance or actions of individuals.\
|
14 |
+
This can involve superimposing images or videos of people onto existing footage,\
|
15 |
+
making individuals appear to say or do things they never said or did.")
|
16 |
+
st.header("Deepfake Fraud Statistics")
|
17 |
+
#st.write("")
|
18 |
+
image = Image.open("C:\\Users\\Paras Sharma\\OneDrive\\Pictures\\Saved Pictures\\deepfake-growth.jpg")
|
19 |
+
new_image = image.resize((600, 400))
|
20 |
+
st.image(new_image)
|
21 |
+
|
22 |
+
|
23 |
+
st.header("Real Cases:")
|
24 |
+
st.markdown("**Kerala Man Loses Rs 40,000 to AI-Based Deepfake WhatsApp Fraud**")
|
25 |
+
st.write("According to India Today, a man in Kerala lost Rs 40,000 in an online scam on WhatsApp involving\
|
26 |
+
AI-based deepfake technology. The scammer impersonated the victim's former\
|
27 |
+
colleague via video call, fabricating a medical emergency and requesting\
|
28 |
+
money. This incident underscores the danger of sophisticated online fraud\
|
29 |
+
using deepfake technology and emphasizes the importance of verifying\
|
30 |
+
unexpected financial requests to avoid falling victim to such scams.")
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
'''st.header("The Dangers of Deepfakes")
|
36 |
+
st.write("Organizations and individuals are at risk regarding deepfakes as it’s a source that leverages social engineering attempts to manufacture fraudulent texts, voice messages, and fake videos to spread misinformation. \
|
37 |
+
According to the US Department of Defense, deepfakes are AI-generated, highly realistic content that can be used to: \
|
38 |
+
Threaten an organization’s brand. \
|
39 |
+
Impersonate leaders and financial officers. \
|
40 |
+
Enable access to networks, communications, and other sensitive information. \
|
41 |
+
In this sense, all companies that are housing business and customer data could be at risk to these attacks.")
|
42 |
+
'''
|
43 |
+
|
pages/community.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
def show_community():
|
5 |
+
st.header("Community")
|
6 |
+
st.write(
|
7 |
+
"""
|
8 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque
|
9 |
+
ultrices felis at ornare. In quis elementum diam. Phasellus facilisis laoreet
|
10 |
+
eros, sed blandit neque sollicitudin at. Vivamus aliquet vehicula nunc, eget
|
11 |
+
tempus tortor gravida quis. Ut rutrum orci velit, sit amet egestas sem
|
12 |
+
elementum id. Nam dignissim sem lectus, in tristique nisl dignissim et.
|
13 |
+
Vestibulum eleifend commodo purus non vestibulum. Pellentesque est lectus,
|
14 |
+
tempus blandit ipsum eleifend, pulvinar sodales lacus. Praesent finibus lectus
|
15 |
+
quis libero feugiat pharetra. Donec et eleifend magna.
|
16 |
+
|
17 |
+
Nam eu erat eget est viverra mollis eu eget dolor. Morbi ac tellus sit amet
|
18 |
+
nisl tempor tempus vitae consectetur elit. Aenean neque nisl, placerat eget
|
19 |
+
tempus vel, dictum in erat. Nullam tristique eros in feugiat auctor. Vivamus ac
|
20 |
+
mi non lacus euismod consectetur. Quisque vel tempus orci. Pellentesque
|
21 |
+
habitant morbi tristique senectus et netus et malesuada fames ac turpis
|
22 |
+
egestas. Cras lacinia purus ut tempor scelerisque. Etiam placerat erat nibh.
|
23 |
+
Cras lectus justo, convallis quis commodo in, aliquet non lectus. Vestibulum
|
24 |
+
ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Ut
|
25 |
+
sodales magna tellus, non interdum ex semper eget. Quisque porttitor augue nec
|
26 |
+
ante gravida finibus sed eget quam.
|
27 |
+
|
28 |
+
### Proin at fermentum nisi
|
29 |
+
Aenean tortor justo, tincidunt non nibh in, iaculis viverra neque. Cras ut mi
|
30 |
+
eu tellus blandit interdum at vitae eros. Fusce vitae condimentum lacus, a
|
31 |
+
viverra arcu. Class aptent taciti sociosqu ad litora torquent per conubia
|
32 |
+
nostra, per inceptos himenaeos:
|
33 |
+
* Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
34 |
+
* Aenean fermentum nibh sit amet malesuada placerat.
|
35 |
+
* Cras sit amet diam ut risus cursus hendrerit.
|
36 |
+
* Duis tempor turpis malesuada ex porta, et viverra tellus fermentum.
|
37 |
+
"""
|
38 |
+
)
|
pages/dashboard.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import sqlite3
|
3 |
+
import re
|
4 |
+
import bcrypt
|
5 |
+
import numpy as np
|
6 |
+
import cv2
|
7 |
+
from PIL import Image
|
8 |
+
import tensorflow as tf
|
9 |
+
import os
|
10 |
+
import warnings
|
11 |
+
|
12 |
+
# Suppress all warnings
|
13 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
14 |
+
warnings.filterwarnings("ignore")
|
15 |
+
np.seterr(all='ignore')
|
16 |
+
|
17 |
+
# Load model
|
18 |
+
deepfake_model = tf.keras.models.load_model("model_15_64.h5")
|
19 |
+
|
20 |
+
|
21 |
+
# Setup SQLite instead of MySQL
|
22 |
+
conn = sqlite3.connect("users.db", check_same_thread=False)
|
23 |
+
cursor = conn.cursor()
|
24 |
+
|
25 |
+
# Create user_details table in SQLite
|
26 |
+
cursor.execute('''
|
27 |
+
CREATE TABLE IF NOT EXISTS user_details (
|
28 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
29 |
+
NAME TEXT,
|
30 |
+
PHONE TEXT,
|
31 |
+
EMAIL TEXT UNIQUE,
|
32 |
+
GENDER TEXT,
|
33 |
+
PASSWORD TEXT
|
34 |
+
)
|
35 |
+
''')
|
36 |
+
conn.commit()
|
37 |
+
|
38 |
+
# Validation utilities
|
39 |
+
def is_valid_email(email):
|
40 |
+
return re.match(r"[^@]+@[^@]+\.[^@]+", email)
|
41 |
+
|
42 |
+
def is_valid_phone(phone):
|
43 |
+
return re.match(r"^[0-9]{10}$", phone)
|
44 |
+
|
45 |
+
def preprocess_image(image):
|
46 |
+
image = np.array(image)
|
47 |
+
image = cv2.resize(image, (128, 128))
|
48 |
+
image = image.astype(np.float32) / 255.0
|
49 |
+
return np.expand_dims(image, axis=0)
|
50 |
+
|
51 |
+
def predict_image(image):
|
52 |
+
preprocessed = preprocess_image(image)
|
53 |
+
prediction = deepfake_model.predict(preprocessed)[0][0]
|
54 |
+
return "✅ Real Image" if prediction >= 0.5 else "⚠️ Fake Image"
|
55 |
+
|
56 |
+
# Register user
|
57 |
+
def register_user(name, phone, email, password):
|
58 |
+
if not is_valid_email(email):
|
59 |
+
return "❌ Invalid email", False
|
60 |
+
if not is_valid_phone(phone):
|
61 |
+
return "❌ Phone must be 10 digits", False
|
62 |
+
|
63 |
+
cursor.execute("SELECT * FROM user_details WHERE EMAIL = ?", (email,))
|
64 |
+
if cursor.fetchone():
|
65 |
+
return "⚠️ Email already registered", False
|
66 |
+
|
67 |
+
hashed_pw = bcrypt.hashpw(password.encode(), bcrypt.gensalt())
|
68 |
+
cursor.execute("INSERT INTO user_details (NAME, PHONE, EMAIL, GENDER, PASSWORD) VALUES (?, ?, ?, ?, ?)",
|
69 |
+
(name, phone, email, "U", hashed_pw))
|
70 |
+
conn.commit()
|
71 |
+
return "✅ Registration successful! Please log in.", True
|
72 |
+
|
73 |
+
# Login user
|
74 |
+
def login_user(email, password):
|
75 |
+
cursor.execute("SELECT PASSWORD FROM user_details WHERE EMAIL = ?", (email,))
|
76 |
+
result = cursor.fetchone()
|
77 |
+
if result and bcrypt.checkpw(password.encode(), result[0].encode() if isinstance(result[0], str) else result[0]):
|
78 |
+
return "✅ Login successful!", True
|
79 |
+
return "❌ Invalid credentials", False
|
80 |
+
|
81 |
+
# App layout
|
82 |
+
with gr.Blocks() as demo:
|
83 |
+
session = gr.State({})
|
84 |
+
show_login = gr.State(True)
|
85 |
+
|
86 |
+
status = gr.Textbox(label="", interactive=False)
|
87 |
+
|
88 |
+
with gr.Column(visible=True) as login_panel:
|
89 |
+
gr.Markdown("### Login or Sign Up")
|
90 |
+
name = gr.Textbox(label="Name (Sign Up Only)")
|
91 |
+
phone = gr.Textbox(label="Phone (Sign Up Only)")
|
92 |
+
email = gr.Textbox(label="Email")
|
93 |
+
password = gr.Textbox(label="Password", type="password")
|
94 |
+
|
95 |
+
login_btn = gr.Button("Login")
|
96 |
+
signup_btn = gr.Button("Sign Up")
|
97 |
+
|
98 |
+
with gr.Column(visible=False) as prediction_panel:
|
99 |
+
gr.Markdown("## Upload Image for Deepfake Detection")
|
100 |
+
image_input = gr.Image(type="pil")
|
101 |
+
result = gr.Textbox(label="Result")
|
102 |
+
predict_btn = gr.Button("Predict")
|
103 |
+
logout_btn = gr.Button("Logout")
|
104 |
+
|
105 |
+
# Logic
|
106 |
+
def handle_login(e, p):
|
107 |
+
msg, ok = login_user(e, p)
|
108 |
+
return msg, gr.update(visible=not ok), gr.update(visible=ok)
|
109 |
+
|
110 |
+
def handle_signup(n, ph, e, p):
|
111 |
+
msg, ok = register_user(n, ph, e, p)
|
112 |
+
return msg
|
113 |
+
|
114 |
+
def handle_logout():
|
115 |
+
return {}, gr.update(visible=True), gr.update(visible=False)
|
116 |
+
|
117 |
+
login_btn.click(handle_login, [email, password], [status, login_panel, prediction_panel])
|
118 |
+
signup_btn.click(handle_signup, [name, phone, email, password], status)
|
119 |
+
predict_btn.click(predict_image, inputs=image_input, outputs=result)
|
120 |
+
logout_btn.click(handle_logout, outputs=[session, login_panel, prediction_panel])
|
121 |
+
|
122 |
+
# Launch
|
123 |
+
if __name__ == "__main__":
|
124 |
+
demo.launch()
|
pages/examples.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
def show_examples():
|
5 |
+
st.header("Examples")
|
6 |
+
col_1, col_2 = st.columns(2, gap="medium")
|
7 |
+
col_1.write(
|
8 |
+
"""
|
9 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum vel augue
|
10 |
+
nec tellus pulvinar blandit at nec lacus. Fusce eu libero quis nisi vehicula
|
11 |
+
ornare. Integer cursus quam suscipit tempor iaculis. Mauris vitae accumsan
|
12 |
+
felis, at elementum urna. Aenean in urna ante. Etiam ac dignissim dolor.
|
13 |
+
Aliquam convallis pretium mauris, vel imperdiet quam fringilla vitae. Donec ac
|
14 |
+
nisi eget nulla cursus consectetur a vitae purus. Quisque vitae aliquet ipsum,
|
15 |
+
quis venenatis odio. Quisque mauris elit, elementum et eros et, varius
|
16 |
+
efficitur magna. Proin dictum tristique tellus, quis viverra lorem tempor
|
17 |
+
vitae. Nulla quis bibendum libero, quis malesuada nisi. Mauris vel aliquam
|
18 |
+
odio. Maecenas nec tortor consectetur, posuere elit vel, sodales ante. Sed ut
|
19 |
+
pretium massa, ut dictum nibh.
|
20 |
+
"""
|
21 |
+
)
|
22 |
+
col_2.write(
|
23 |
+
"""
|
24 |
+
Etiam dolor sem, bibendum id lacus eget, porta hendrerit mauris. Fusce varius
|
25 |
+
consequat erat, sit amet rhoncus lectus vestibulum vel. Cras vitae lacinia
|
26 |
+
nibh. Aenean varius facilisis tellus, vitae egestas magna pharetra ut. Maecenas
|
27 |
+
condimentum metus diam, facilisis rhoncus lorem lacinia eu. Maecenas eleifend
|
28 |
+
mauris velit, vitae placerat elit commodo ut. Ut ut purus elit. Suspendisse
|
29 |
+
condimentum quam sit amet vulputate vehicula. Nulla et quam at mauris cursus
|
30 |
+
euismod. Curabitur nec massa non tortor commodo condimentum eu at metus. Fusce
|
31 |
+
aliquet dolor nulla, quis feugiat sem bibendum vel. Donec tempus placerat leo
|
32 |
+
vitae blandit.
|
33 |
+
"""
|
34 |
+
)
|
pages/home.py
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import mysql.connector
|
3 |
+
import re
|
4 |
+
import tensorflow as tf
|
5 |
+
from PIL import Image
|
6 |
+
import numpy as np
|
7 |
+
import cv2
|
8 |
+
|
9 |
+
# Initialize database connection
|
10 |
+
try:
|
11 |
+
mydb = mysql.connector.connect(
|
12 |
+
host="localhost",
|
13 |
+
user="root",
|
14 |
+
password="12345",
|
15 |
+
database="user_info"
|
16 |
+
)
|
17 |
+
mycursor = mydb.cursor()
|
18 |
+
print("Connection Established")
|
19 |
+
except mysql.connector.Error as err:
|
20 |
+
print(f"Error: {err}")
|
21 |
+
st.error("Database connection failed.")
|
22 |
+
|
23 |
+
# Load the deepfake detection model
|
24 |
+
deepfake_model_path = "C:\\Users\\Paras Sharma\\OneDrive\\Documents\\Deepfake\\model_15_64 (1).h5"
|
25 |
+
deepfake_model = tf.keras.models.load_model(deepfake_model_path)
|
26 |
+
|
27 |
+
def validate_name(name):
|
28 |
+
if re.match(r"^[a-zA-Z]+\s[a-zA-Z]+$", name):
|
29 |
+
return True
|
30 |
+
else:
|
31 |
+
st.warning("Please enter a valid name (e.g., Firstname Lastname).")
|
32 |
+
return False
|
33 |
+
|
34 |
+
def validate_phone(phone):
|
35 |
+
if re.match(r"^[0-9]{10}$", phone):
|
36 |
+
return True
|
37 |
+
else:
|
38 |
+
st.warning("Please enter a valid 10-digit phone number.")
|
39 |
+
return False
|
40 |
+
|
41 |
+
def validate_email(email):
|
42 |
+
email_pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
|
43 |
+
if re.match(email_pattern, email):
|
44 |
+
return True
|
45 |
+
else:
|
46 |
+
st.warning("Please enter a valid email.")
|
47 |
+
return False
|
48 |
+
|
49 |
+
def preprocess_image(image):
|
50 |
+
try:
|
51 |
+
image = np.array(image)
|
52 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Convert BGR to RGB
|
53 |
+
image = cv2.resize(image, (128, 128)) # Resize to match model input size
|
54 |
+
image = image.astype(np.float32) / 255.0 # Normalize pixel values
|
55 |
+
return np.expand_dims(image, axis=0) # Add batch dimension
|
56 |
+
except Exception as e:
|
57 |
+
print(f"Error preprocessing image: {e}")
|
58 |
+
return None
|
59 |
+
|
60 |
+
def predict_deepfake(image):
|
61 |
+
preprocessed_image = preprocess_image(image)
|
62 |
+
if preprocessed_image is not None:
|
63 |
+
prediction = deepfake_model.predict(preprocessed_image)
|
64 |
+
return prediction[0][0] # Assuming the model outputs a single value between 0 and 1
|
65 |
+
else:
|
66 |
+
return None
|
67 |
+
|
68 |
+
def show_home():
|
69 |
+
st.header(' ')
|
70 |
+
st.markdown("<h1 style='text-align: center; color: black;'>AuthentiTech: Leveraging Machine Learning to Combat Deepfake Detection</h1>", unsafe_allow_html=True)
|
71 |
+
st.header(' ', divider="rainbow")
|
72 |
+
st.header(' ')
|
73 |
+
|
74 |
+
st.markdown("<p style='font-size: medium;'>Enter Your Details</p>", unsafe_allow_html=True)
|
75 |
+
|
76 |
+
NAME = st.text_input('Name: ', st.session_state.get('name', ''))
|
77 |
+
if not validate_name(NAME):
|
78 |
+
return
|
79 |
+
|
80 |
+
PHONE = st.text_input('Contact Number(+91): ', max_chars=10)
|
81 |
+
PHONE = PHONE.strip() # Remove any leading/trailing spaces
|
82 |
+
if not validate_phone(PHONE):
|
83 |
+
return
|
84 |
+
|
85 |
+
GENDER = st.selectbox('Enter gender', ('F', 'M', 'other'))
|
86 |
+
|
87 |
+
EMAIL = st.text_input('Email: ', st.session_state.get('EMAIL', ''))
|
88 |
+
if not validate_email(EMAIL):
|
89 |
+
return
|
90 |
+
|
91 |
+
if st.button("Submit"):
|
92 |
+
try:
|
93 |
+
sql = "INSERT INTO user_details (NAME, PHONE, EMAIL, GENDER) VALUES (%s, %s, %s, %s)"
|
94 |
+
val = (NAME, PHONE, EMAIL, GENDER)
|
95 |
+
mycursor.execute(sql, val)
|
96 |
+
mydb.commit()
|
97 |
+
st.session_state['name'] = NAME
|
98 |
+
st.session_state['EMAIL'] = EMAIL
|
99 |
+
st.success("Details submitted successfully!")
|
100 |
+
except mysql.connector.Error as err:
|
101 |
+
st.error(f"Error: {err}")
|
102 |
+
print(f"Error executing SQL: {err}")
|
103 |
+
|
104 |
+
st.write("Upload your image (JPEG, JPG, PNG) here (max size: 15 KB):")
|
105 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"], accept_multiple_files=False, key="file_uploader")
|
106 |
+
|
107 |
+
if uploaded_file is not None:
|
108 |
+
file_details = {"FileName": uploaded_file.name, "FileType": uploaded_file.type, "FileSize": uploaded_file.size}
|
109 |
+
st.write(file_details)
|
110 |
+
image = Image.open(uploaded_file)
|
111 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
112 |
+
|
113 |
+
if st.button("Detect Now"):
|
114 |
+
prediction = predict_deepfake(image)
|
115 |
+
if prediction < 0.5:
|
116 |
+
st.write("Fake Image")
|
117 |
+
else:
|
118 |
+
st.write("Real Image")
|
119 |
+
else:
|
120 |
+
st.warning("Please upload an image.")
|
121 |
+
|
122 |
+
if __name__ == "__main__":
|
123 |
+
show_home()
|
pages/install.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
def show_install():
|
5 |
+
st.header("What are the dangers of Deepfakes?")
|
6 |
+
st.header(' ');
|
7 |
+
st.subheader("Misinformation and Fake News:")
|
8 |
+
st.write(
|
9 |
+
"""
|
10 |
+
Deepfakes can be used to create highly convincing yet completely
|
11 |
+
fabricated content. This poses a significant threat in the realm of
|
12 |
+
information dissemination, as fake videos or audio clips can be
|
13 |
+
circulated to deceive people into believing events that never occurred
|
14 |
+
or statements that were never made. This can lead to the spread of
|
15 |
+
false narratives, misinformation, and confusion among the public.
|
16 |
+
"""
|
17 |
+
)
|
pages/user_guide.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
def show_user_guide():
|
5 |
+
st.header(' ')
|
6 |
+
st.header(' ')
|
7 |
+
st.header("User guide")
|
8 |
+
st.header(' ')
|
9 |
+
|
10 |
+
container = st.container(border=True)
|
11 |
+
container.markdown(''':blue[**Step 1:**]''')
|
12 |
+
container.write("Create an account to get access")
|
13 |
+
|
14 |
+
container2 = st.container(border=True)
|
15 |
+
container2.markdown(''':blue[**Step 2:**]''')
|
16 |
+
container2.write("Upload your Images")
|
17 |
+
|
18 |
+
container3 = st.container(border=True)
|
19 |
+
container3.markdown(''':blue[**Step 3:**]''')
|
20 |
+
container3.write("Get the results")
|
21 |
+
|
22 |
+
#row1 = st.columns(1)
|
23 |
+
#row2 = st.columns(1)
|
24 |
+
#row3 = st.columns(1)
|
25 |
+
|
26 |
+
|
27 |
+
#for col in row1:
|
28 |
+
#with st.container():
|
29 |
+
#tile = col.container(height=120)
|
30 |
+
#st.title(":balloon:")
|
31 |
+
|
32 |
+
#st.subheader("Step 1: ")
|
33 |
+
#for col in row1:
|
34 |
+
#tile = col.container(height=120)
|
35 |
+
#st.markdown(":user: **Step 1:**")
|
36 |
+
#st.write("Create an account and subscribe to get access")
|
37 |
+
|
38 |
+
#tile.title(":balloon:")
|
39 |
+
#st.write("This is outside the container")
|
40 |
+
|
41 |
+
#Now insert some more in the container
|
42 |
+
#container.write("This is inside too")
|
43 |
+
|