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")
|
@@ -32,7 +32,7 @@ def compress_image(image, quality=50, max_size=(20, 20)): # β
Better quality
|
|
32 |
|
33 |
if uploaded_image is not None:
|
34 |
compressed_image_path = compress_image(uploaded_image)
|
35 |
-
st.image(compressed_image_path, caption="πΌοΈ Compressed Image",
|
36 |
if st.button("Analyze Image"):
|
37 |
st.write("π Processing...")
|
38 |
st.error("β οΈ Result: This image is a Deepfake.") # Replace with model
|
@@ -57,8 +57,8 @@ 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, 12.0, (frame_width, frame_height)) # β
Lower FPS to 12
|
63 |
|
64 |
while cap.isOpened():
|
@@ -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=60, 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")
|
|
|
32 |
|
33 |
if uploaded_image is not None:
|
34 |
compressed_image_path = compress_image(uploaded_image)
|
35 |
+
st.image(compressed_image_path, caption="πΌοΈ Compressed Image", use_container_width=True)
|
36 |
if st.button("Analyze Image"):
|
37 |
st.write("π Processing...")
|
38 |
st.error("β οΈ Result: This image is a Deepfake.") # Replace with model
|
|
|
57 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
58 |
|
59 |
# β
Further Reduce Video Resolution
|
60 |
+
frame_width = 180
|
61 |
+
frame_height = 320 # Adjusted for a more standard small resolution
|
62 |
out = cv2.VideoWriter(temp_file.name, fourcc, 12.0, (frame_width, frame_height)) # β
Lower FPS to 12
|
63 |
|
64 |
while cap.isOpened():
|
|
|
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**")
|