Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ if st.button("Check News"):
|
|
23 |
st.subheader("๐ธ Deepfake Image Detection")
|
24 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
25 |
|
26 |
-
def compress_image(image, quality=
|
27 |
img = Image.open(image).convert("RGB")
|
28 |
img.thumbnail(max_size)
|
29 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".jpg")
|
@@ -57,9 +57,9 @@ def compress_video(video):
|
|
57 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
58 |
|
59 |
# โ
Further Reduce Video Resolution
|
60 |
-
frame_width =
|
61 |
-
frame_height =
|
62 |
-
out = cv2.VideoWriter(temp_file.name, fourcc,
|
63 |
|
64 |
while cap.isOpened():
|
65 |
ret, frame = cap.read()
|
@@ -81,4 +81,4 @@ if uploaded_video is not None:
|
|
81 |
st.write("๐ Processing...")
|
82 |
st.warning("โ ๏ธ Result: This video contains Deepfake elements.") # Replace with model
|
83 |
|
84 |
-
st.markdown("๐น **Developed for Fake News & Deepfake Detection Hackathon**")
|
|
|
23 |
st.subheader("๐ธ Deepfake Image Detection")
|
24 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
25 |
|
26 |
+
def compress_image(image, quality=50, max_size=(100, 100)): # โ
Better quality & small size
|
27 |
img = Image.open(image).convert("RGB")
|
28 |
img.thumbnail(max_size)
|
29 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".jpg")
|
|
|
57 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
58 |
|
59 |
# โ
Further Reduce Video Resolution
|
60 |
+
frame_width = 200
|
61 |
+
frame_height = 120
|
62 |
+
out = cv2.VideoWriter(temp_file.name, fourcc, 12.0, (frame_width, frame_height)) # โ
Lower FPS to 12
|
63 |
|
64 |
while cap.isOpened():
|
65 |
ret, frame = cap.read()
|
|
|
81 |
st.write("๐ Processing...")
|
82 |
st.warning("โ ๏ธ Result: This video contains Deepfake elements.") # Replace with model
|
83 |
|
84 |
+
st.markdown("๐น **Developed for Fake News & Deepfake Detection Hackathon**")
|