Update app.py
Browse files
app.py
CHANGED
|
@@ -143,7 +143,7 @@ def crear_graficos_estadisticas(porcentaje_ela, dimensiones, metadatos):
|
|
| 143 |
fig_bar.add_trace(go.Bar(
|
| 144 |
x=['Áreas Detectadas'],
|
| 145 |
y=[porcentaje_ela],
|
| 146 |
-
marker_color=['#
|
| 147 |
text=[f'{porcentaje_ela:.3f}%'],
|
| 148 |
textposition='auto',
|
| 149 |
))
|
|
@@ -259,34 +259,34 @@ def procesar_imagen(archivo_imagen):
|
|
| 259 |
else:
|
| 260 |
file_size = f"{file_size_bytes / (1024 * 1024):.2f} MB"
|
| 261 |
|
| 262 |
-
info_basica = f"
|
| 263 |
-
info_basica += f"
|
| 264 |
-
info_basica += f"
|
| 265 |
-
info_basica += f"
|
| 266 |
-
info_basica += f"
|
| 267 |
|
| 268 |
metadatos = obtener_metadatos(img)
|
| 269 |
-
info_metadatos = "
|
| 270 |
|
| 271 |
google_maps_url = None
|
| 272 |
|
| 273 |
if metadatos:
|
| 274 |
for tag, value in metadatos.items():
|
| 275 |
if tag == "DateTime":
|
| 276 |
-
info_metadatos += f"-
|
| 277 |
elif tag == "Make":
|
| 278 |
-
info_metadatos += f"-
|
| 279 |
elif tag == "Model":
|
| 280 |
-
info_metadatos += f"-
|
| 281 |
elif tag == "Software":
|
| 282 |
-
info_metadatos += f"-
|
| 283 |
elif tag == "GPSInfo":
|
| 284 |
coords = obtener_coordenadas(metadatos)
|
| 285 |
if coords:
|
| 286 |
lat, lon = coords
|
| 287 |
-
info_metadatos += f"-
|
| 288 |
google_maps_url = f"https://www.google.com/maps?q={lat},{lon}"
|
| 289 |
-
info_metadatos += f"-
|
| 290 |
else:
|
| 291 |
info_metadatos += "- **Coordenadas GPS:** No se encontraron coordenadas válidas\r\n"
|
| 292 |
else:
|
|
@@ -298,9 +298,9 @@ def procesar_imagen(archivo_imagen):
|
|
| 298 |
info_metadatos += f"\r\n**SHA3-256:** {sha3_hash}\r\n\r\n"
|
| 299 |
|
| 300 |
manipulada, razones = analizar_manipulacion(img, metadatos)
|
| 301 |
-
info_manipulacion = "
|
| 302 |
-
info_manipulacion += f"-
|
| 303 |
-
info_manipulacion += f"-
|
| 304 |
|
| 305 |
if manipulada:
|
| 306 |
info_manipulacion += "⚠️ **LA IMAGEN HA SIDO MANIPULADA.**\r\n**Razones:**\r\n"
|
|
@@ -389,7 +389,7 @@ with gr.Blocks(title="Análisis Forense de Imágenes con ELA", theme=theme, css=
|
|
| 389 |
with gr.Column():
|
| 390 |
with gr.Accordion("**Resultado del Análisis ELA**", open=True):
|
| 391 |
ela_image = gr.Image(
|
| 392 |
-
label="**🔍 ÁREAS
|
| 393 |
type="numpy",
|
| 394 |
height=400,
|
| 395 |
show_label=True,
|
|
|
|
| 143 |
fig_bar.add_trace(go.Bar(
|
| 144 |
x=['Áreas Detectadas'],
|
| 145 |
y=[porcentaje_ela],
|
| 146 |
+
marker_color=['#4CAF50' if porcentaje_ela > 2 else '#36A2EB'],
|
| 147 |
text=[f'{porcentaje_ela:.3f}%'],
|
| 148 |
textposition='auto',
|
| 149 |
))
|
|
|
|
| 259 |
else:
|
| 260 |
file_size = f"{file_size_bytes / (1024 * 1024):.2f} MB"
|
| 261 |
|
| 262 |
+
info_basica = f"Nombre del archivo: {nombre_original}\r\n"
|
| 263 |
+
info_basica += f"Tamaño del archivo: {file_size}\r\n"
|
| 264 |
+
info_basica += f"Dimensiones: {img.size[0]} x {img.size[1]} píxeles\r\n"
|
| 265 |
+
info_basica += f"Formato: {img.format}\r\n"
|
| 266 |
+
info_basica += f"Modo: {img.mode}\r\n\r\n"
|
| 267 |
|
| 268 |
metadatos = obtener_metadatos(img)
|
| 269 |
+
info_metadatos = "ANÁLISIS FORENSE DE LOS METADATOS:\r\n\r\n"
|
| 270 |
|
| 271 |
google_maps_url = None
|
| 272 |
|
| 273 |
if metadatos:
|
| 274 |
for tag, value in metadatos.items():
|
| 275 |
if tag == "DateTime":
|
| 276 |
+
info_metadatos += f"- Fecha y hora de captura: {value}\r\n"
|
| 277 |
elif tag == "Make":
|
| 278 |
+
info_metadatos += f"- Fabricante de cámara: {value}\r\n"
|
| 279 |
elif tag == "Model":
|
| 280 |
+
info_metadatos += f"- Modelo de cámara: {value}\r\n"
|
| 281 |
elif tag == "Software":
|
| 282 |
+
info_metadatos += f"- Software de edición: {value}\r\n"
|
| 283 |
elif tag == "GPSInfo":
|
| 284 |
coords = obtener_coordenadas(metadatos)
|
| 285 |
if coords:
|
| 286 |
lat, lon = coords
|
| 287 |
+
info_metadatos += f"- Coordenadas GPS: {lat:.6f}, {lon:.6f}\r\n"
|
| 288 |
google_maps_url = f"https://www.google.com/maps?q={lat},{lon}"
|
| 289 |
+
info_metadatos += f"- Enlace a Google Maps: {google_maps_url}\r\n"
|
| 290 |
else:
|
| 291 |
info_metadatos += "- **Coordenadas GPS:** No se encontraron coordenadas válidas\r\n"
|
| 292 |
else:
|
|
|
|
| 298 |
info_metadatos += f"\r\n**SHA3-256:** {sha3_hash}\r\n\r\n"
|
| 299 |
|
| 300 |
manipulada, razones = analizar_manipulacion(img, metadatos)
|
| 301 |
+
info_manipulacion = "ANÁLISIS DE MANIPULACIÓN:\r\n\r\n"
|
| 302 |
+
info_manipulacion += f"- Porcentaje de áreas detectadas: {porcentaje_ela:.3f}%\r\n"
|
| 303 |
+
info_manipulacion += f"- Estimación forense: {probabilidad}\r\n\r\n"
|
| 304 |
|
| 305 |
if manipulada:
|
| 306 |
info_manipulacion += "⚠️ **LA IMAGEN HA SIDO MANIPULADA.**\r\n**Razones:**\r\n"
|
|
|
|
| 389 |
with gr.Column():
|
| 390 |
with gr.Accordion("**Resultado del Análisis ELA**", open=True):
|
| 391 |
ela_image = gr.Image(
|
| 392 |
+
label="**🔍 ÁREAS TURQUESA = manipulaciones o borrados**",
|
| 393 |
type="numpy",
|
| 394 |
height=400,
|
| 395 |
show_label=True,
|