Update app.py
Browse files
app.py
CHANGED
|
@@ -299,6 +299,10 @@ if st.button("Check News"):
|
|
| 299 |
st.success(f"โ
Result: This news is **REAL**. (Confidence: {confidence:.2f})")
|
| 300 |
|
| 301 |
# ---- Deepfake Image Detection Section ----
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
st.subheader("๐ธ Deepfake Image Detection")
|
| 303 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
| 304 |
|
|
@@ -306,16 +310,19 @@ if uploaded_image is not None:
|
|
| 306 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".jpg")
|
| 307 |
img = Image.open(uploaded_image).convert("RGB")
|
| 308 |
img.save(temp_file.name, "JPEG")
|
| 309 |
-
|
|
|
|
|
|
|
| 310 |
|
| 311 |
if st.button("Analyze Image"):
|
| 312 |
st.write("๐ Processing...")
|
|
|
|
|
|
|
| 313 |
result = detect_deepfake_image(temp_file.name)
|
| 314 |
|
| 315 |
if result["label"] == "REAL":
|
| 316 |
-
|
| 317 |
-
else:
|
| 318 |
-
|
| 319 |
st.error(f"โ ๏ธ Result: This image is a Deepfake. (Confidence: {result['score']:.2f})")
|
| 320 |
|
| 321 |
# # ---- Deepfake Video Detection Section ----
|
|
|
|
| 299 |
st.success(f"โ
Result: This news is **REAL**. (Confidence: {confidence:.2f})")
|
| 300 |
|
| 301 |
# ---- Deepfake Image Detection Section ----
|
| 302 |
+
import streamlit as st
|
| 303 |
+
import tempfile
|
| 304 |
+
from PIL import Image
|
| 305 |
+
|
| 306 |
st.subheader("๐ธ Deepfake Image Detection")
|
| 307 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
| 308 |
|
|
|
|
| 310 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".jpg")
|
| 311 |
img = Image.open(uploaded_image).convert("RGB")
|
| 312 |
img.save(temp_file.name, "JPEG")
|
| 313 |
+
|
| 314 |
+
# ๐ ๏ธ FIX: use_container_width=True instead of use_column_width=True
|
| 315 |
+
st.image(temp_file.name, caption="๐ผ๏ธ Uploaded Image", use_container_width=True)
|
| 316 |
|
| 317 |
if st.button("Analyze Image"):
|
| 318 |
st.write("๐ Processing...")
|
| 319 |
+
|
| 320 |
+
# Assuming detect_deepfake_image() is a function that returns a dictionary with "label" and "score"
|
| 321 |
result = detect_deepfake_image(temp_file.name)
|
| 322 |
|
| 323 |
if result["label"] == "REAL":
|
| 324 |
+
st.success(f"โ
Result: This image is Real. (Confidence: {1 - result['score']:.2f})")
|
| 325 |
+
else:
|
|
|
|
| 326 |
st.error(f"โ ๏ธ Result: This image is a Deepfake. (Confidence: {result['score']:.2f})")
|
| 327 |
|
| 328 |
# # ---- Deepfake Video Detection Section ----
|