Spaces:
Sleeping
Sleeping
Update streamlit_app.py
Browse files- streamlit_app.py +13 -1
streamlit_app.py
CHANGED
|
@@ -27,6 +27,7 @@ if module == "Text Misinformation":
|
|
| 27 |
else:
|
| 28 |
st.warning("Please enter some text.")
|
| 29 |
|
|
|
|
| 30 |
# Image Deepfake Detection
|
| 31 |
elif module == "Image Deepfake":
|
| 32 |
st.title("🖼️ Deepfake Image Detection")
|
|
@@ -36,5 +37,16 @@ elif module == "Image Deepfake":
|
|
| 36 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 37 |
model = load_image_model()
|
| 38 |
result = model(image)[0]
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
st.write(f"Confidence: {result['score']:.2f}")
|
|
|
|
| 27 |
else:
|
| 28 |
st.warning("Please enter some text.")
|
| 29 |
|
| 30 |
+
|
| 31 |
# Image Deepfake Detection
|
| 32 |
elif module == "Image Deepfake":
|
| 33 |
st.title("🖼️ Deepfake Image Detection")
|
|
|
|
| 37 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 38 |
model = load_image_model()
|
| 39 |
result = model(image)[0]
|
| 40 |
+
|
| 41 |
+
# Map label_0 and label_1 to meaningful labels with icons and colors
|
| 42 |
+
label_map = {
|
| 43 |
+
"LABEL_0": ("Unauthentic", "❌", "red"),
|
| 44 |
+
"LABEL_1": ("Authentic", "✅", "green")
|
| 45 |
+
}
|
| 46 |
+
label, icon, color = label_map.get(result['label'].upper(), (result['label'], "❓", "gray"))
|
| 47 |
+
|
| 48 |
+
st.markdown(
|
| 49 |
+
f"<h4 style='color:{color};'>{icon} Prediction: {label}</h4>",
|
| 50 |
+
unsafe_allow_html=True
|
| 51 |
+
)
|
| 52 |
st.write(f"Confidence: {result['score']:.2f}")
|