Spaces:
Sleeping
Sleeping
Kesheratmex
commited on
Commit
·
8481363
1
Parent(s):
c3348cf
**Subject**
Browse filesImprove access UI styling, labels, and add system info block
**Body**
Enhance the access section with richer styling, clearer labels, and a new system‑information panel. Updated the instructions group to match the new design.
app.py
CHANGED
|
@@ -1314,80 +1314,156 @@ with gr.Blocks(
|
|
| 1314 |
</div>
|
| 1315 |
""")
|
| 1316 |
|
| 1317 |
-
# Sección de acceso mejorada
|
| 1318 |
with gr.Group(visible=True) as gate_group:
|
| 1319 |
gr.HTML("""
|
| 1320 |
-
<div
|
| 1321 |
-
<
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1327 |
</div>
|
| 1328 |
""")
|
| 1329 |
|
| 1330 |
with gr.Row():
|
| 1331 |
-
with gr.Column(scale=
|
| 1332 |
gate_token = gr.Textbox(
|
| 1333 |
-
label="Token de Acceso",
|
| 1334 |
type="password",
|
| 1335 |
placeholder="Introduce tu token de seguridad aquí...",
|
| 1336 |
-
info="
|
|
|
|
|
|
|
| 1337 |
)
|
| 1338 |
with gr.Column(scale=1):
|
| 1339 |
-
btn_enter = gr.Button(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1340 |
|
| 1341 |
gate_status = gr.Markdown(visible=False)
|
| 1342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1343 |
with gr.Group(visible=False) as app_group:
|
| 1344 |
-
# Sección de instrucciones principales
|
| 1345 |
gr.HTML("""
|
| 1346 |
-
<div style="background: #ffffff; border:
|
| 1347 |
-
<h3 style="margin-top: 0; color: #
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
<
|
| 1353 |
-
|
| 1354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1355 |
</div>
|
| 1356 |
""")
|
| 1357 |
|
| 1358 |
# Input section: tabs for different media types
|
| 1359 |
with gr.Tabs() as media_tabs:
|
| 1360 |
# Video tab: only video input
|
| 1361 |
-
with gr.TabItem("Análisis de Vídeo"):
|
| 1362 |
gr.HTML("""
|
| 1363 |
-
<div style="background: linear-gradient(135deg, #
|
| 1364 |
-
<
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1370 |
</div>
|
| 1371 |
""")
|
| 1372 |
video_input = gr.Video(
|
| 1373 |
-
label="Arrastra tu vídeo aquí o haz clic para seleccionar"
|
|
|
|
| 1374 |
)
|
| 1375 |
|
| 1376 |
# Imagen tab: only image input
|
| 1377 |
-
with gr.TabItem("Análisis de Imagen"):
|
| 1378 |
gr.HTML("""
|
| 1379 |
-
<div style="background: linear-gradient(135deg, #
|
| 1380 |
-
<
|
| 1381 |
-
|
| 1382 |
-
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1386 |
</div>
|
| 1387 |
""")
|
| 1388 |
image_input = gr.Image(
|
| 1389 |
type="filepath",
|
| 1390 |
-
label="Arrastra tu imagen aquí o haz clic para seleccionar"
|
|
|
|
| 1391 |
)
|
| 1392 |
# Configuración tab: classes and sensitivity controls
|
| 1393 |
with gr.TabItem("Configuración Avanzada"):
|
|
@@ -1586,13 +1662,28 @@ with gr.Blocks(
|
|
| 1586 |
</div>
|
| 1587 |
""")
|
| 1588 |
|
| 1589 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1590 |
btn_detect = gr.Button(
|
| 1591 |
-
"Iniciar Análisis con KESHERAT AI",
|
| 1592 |
-
variant="primary"
|
|
|
|
|
|
|
| 1593 |
)
|
| 1594 |
|
| 1595 |
-
#
|
| 1596 |
loading_status = gr.HTML(visible=False)
|
| 1597 |
|
| 1598 |
# Paleta de colores siempre visible para referencia rápida
|
|
@@ -1706,46 +1797,7 @@ with gr.Blocks(
|
|
| 1706 |
json_video = gr.JSON(visible=False)
|
| 1707 |
json_image = gr.JSON(visible=False)
|
| 1708 |
|
| 1709 |
-
#
|
| 1710 |
-
def _update_video_output(json_result):
|
| 1711 |
-
if json_result and json_result.get("video"):
|
| 1712 |
-
return (
|
| 1713 |
-
gr.HTML(visible=False), # Hide loading
|
| 1714 |
-
gr.Video(value=json_result["video"], visible=True),
|
| 1715 |
-
gr.Image(visible=False),
|
| 1716 |
-
gr.Markdown(visible=False)
|
| 1717 |
-
)
|
| 1718 |
-
return (
|
| 1719 |
-
gr.HTML(visible=False), # Hide loading
|
| 1720 |
-
gr.Video(visible=False),
|
| 1721 |
-
gr.Image(visible=False),
|
| 1722 |
-
gr.Markdown(visible=False)
|
| 1723 |
-
)
|
| 1724 |
-
|
| 1725 |
-
def _update_image_output(json_result):
|
| 1726 |
-
if json_result and json_result.get("path"):
|
| 1727 |
-
# Generar resumen de detecciones para el análisis de KESHERAT AI
|
| 1728 |
-
classes = json_result.get("classes", {})
|
| 1729 |
-
if classes:
|
| 1730 |
-
detections_summary = "Detecciones automáticas: " + ", ".join([f"{k}: {v}" for k, v in classes.items()])
|
| 1731 |
-
else:
|
| 1732 |
-
detections_summary = "No se detectaron defectos automáticamente"
|
| 1733 |
-
|
| 1734 |
-
# Obtener análisis de KESHERAT AI
|
| 1735 |
-
analysis = analyze_image_with_ai(json_result["path"], detections_summary)
|
| 1736 |
-
|
| 1737 |
-
return (
|
| 1738 |
-
gr.HTML(visible=False), # Hide loading
|
| 1739 |
-
gr.Video(visible=False),
|
| 1740 |
-
gr.Image(value=json_result["path"], visible=True),
|
| 1741 |
-
gr.Markdown(value=analysis, visible=True)
|
| 1742 |
-
)
|
| 1743 |
-
return (
|
| 1744 |
-
gr.HTML(visible=False), # Hide loading
|
| 1745 |
-
gr.Video(visible=False),
|
| 1746 |
-
gr.Image(visible=False),
|
| 1747 |
-
gr.Markdown(visible=False)
|
| 1748 |
-
)
|
| 1749 |
|
| 1750 |
# Función unificada para manejar tanto video como imagen
|
| 1751 |
def process_media_unified(video_file, image_file):
|
|
@@ -1832,6 +1884,48 @@ with gr.Blocks(
|
|
| 1832 |
btn_enter.click(fn=_check_token, inputs=[gate_token], outputs=[gate_group, app_group, gate_status])
|
| 1833 |
|
| 1834 |
# Habilitar cola para ZeroGPU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1835 |
demo.queue()
|
| 1836 |
|
| 1837 |
if __name__ == "__main__":
|
|
|
|
| 1314 |
</div>
|
| 1315 |
""")
|
| 1316 |
|
| 1317 |
+
# Sección de acceso mejorada y más amigable
|
| 1318 |
with gr.Group(visible=True) as gate_group:
|
| 1319 |
gr.HTML("""
|
| 1320 |
+
<div style="background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); border: 2px solid #dee2e6; border-radius: 20px; padding: 40px; margin: 30px 0; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.1);">
|
| 1321 |
+
<div style="background: #ffffff; border-radius: 15px; padding: 30px; margin-bottom: 25px; box-shadow: 0 4px 20px rgba(0,0,0,0.05);">
|
| 1322 |
+
<h2 style="color: #0d6efd; margin-bottom: 15px; font-size: 1.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px;">
|
| 1323 |
+
<span style="background: #0d6efd; color: white; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px;">🔐</span>
|
| 1324 |
+
Acceso Seguro al Sistema
|
| 1325 |
+
</h2>
|
| 1326 |
+
<p style="color: #495057; margin-bottom: 0; font-size: 16px; font-weight: 500; line-height: 1.6;">
|
| 1327 |
+
Bienvenido a KESHERAT AI. Para comenzar el análisis inteligente de turbinas eólicas,
|
| 1328 |
+
introduce tu token de acceso autorizado.
|
| 1329 |
+
</p>
|
| 1330 |
+
</div>
|
| 1331 |
</div>
|
| 1332 |
""")
|
| 1333 |
|
| 1334 |
with gr.Row():
|
| 1335 |
+
with gr.Column(scale=3):
|
| 1336 |
gate_token = gr.Textbox(
|
| 1337 |
+
label="🔑 Token de Acceso",
|
| 1338 |
type="password",
|
| 1339 |
placeholder="Introduce tu token de seguridad aquí...",
|
| 1340 |
+
info="💡 ¿No tienes token? Contacta al administrador del sistema para obtener acceso",
|
| 1341 |
+
container=True,
|
| 1342 |
+
show_label=True
|
| 1343 |
)
|
| 1344 |
with gr.Column(scale=1):
|
| 1345 |
+
btn_enter = gr.Button(
|
| 1346 |
+
"🚀 Acceder al Sistema",
|
| 1347 |
+
variant="primary",
|
| 1348 |
+
size="lg"
|
| 1349 |
+
)
|
| 1350 |
|
| 1351 |
gate_status = gr.Markdown(visible=False)
|
| 1352 |
|
| 1353 |
+
# Información adicional amigable
|
| 1354 |
+
gr.HTML("""
|
| 1355 |
+
<div style="background: #e3f2fd; border: 1px solid #bbdefb; border-radius: 12px; padding: 20px; margin: 20px 0; text-align: center;">
|
| 1356 |
+
<h4 style="color: #1565c0; margin-bottom: 10px; font-size: 1rem; font-weight: 600;">
|
| 1357 |
+
ℹ️ Información del Sistema
|
| 1358 |
+
</h4>
|
| 1359 |
+
<p style="color: #1976d2; margin-bottom: 0; font-size: 14px; line-height: 1.5;">
|
| 1360 |
+
KESHERAT AI utiliza tecnología avanzada de inteligencia artificial para detectar automáticamente
|
| 1361 |
+
defectos en palas de turbinas eólicas. El sistema es seguro y todos los análisis se procesan
|
| 1362 |
+
de forma confidencial.
|
| 1363 |
+
</p>
|
| 1364 |
+
</div>
|
| 1365 |
+
""")
|
| 1366 |
+
|
| 1367 |
with gr.Group(visible=False) as app_group:
|
| 1368 |
+
# Sección de instrucciones principales mejorada
|
| 1369 |
gr.HTML("""
|
| 1370 |
+
<div style="background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%); border: 2px solid #e9ecef; border-radius: 16px; padding: 30px; margin: 20px 0; box-shadow: 0 6px 24px rgba(0,0,0,0.08);">
|
| 1371 |
+
<h3 style="margin-top: 0; color: #0d6efd; font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 20px;">
|
| 1372 |
+
<span style="background: #0d6efd; color: white; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px;">📋</span>
|
| 1373 |
+
Guía Rápida de Uso
|
| 1374 |
+
</h3>
|
| 1375 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;">
|
| 1376 |
+
<div style="background: #e3f2fd; border-radius: 12px; padding: 20px; border-left: 4px solid #2196f3;">
|
| 1377 |
+
<h4 style="color: #1565c0; margin: 0 0 10px 0; font-weight: 600; display: flex; align-items: center; gap: 8px;">
|
| 1378 |
+
<span style="font-size: 18px;">1️⃣</span> Selecciona Tipo
|
| 1379 |
+
</h4>
|
| 1380 |
+
<p style="color: #1976d2; margin: 0; font-size: 14px; line-height: 1.4;">
|
| 1381 |
+
Elige entre las pestañas "Vídeo" o "Imagen" según tu archivo de inspección
|
| 1382 |
+
</p>
|
| 1383 |
+
</div>
|
| 1384 |
+
<div style="background: #e8f5e8; border-radius: 12px; padding: 20px; border-left: 4px solid #4caf50;">
|
| 1385 |
+
<h4 style="color: #2e7d32; margin: 0 0 10px 0; font-weight: 600; display: flex; align-items: center; gap: 8px;">
|
| 1386 |
+
<span style="font-size: 18px;">2️⃣</span> Sube Archivo
|
| 1387 |
+
</h4>
|
| 1388 |
+
<p style="color: #388e3c; margin: 0; font-size: 14px; line-height: 1.4;">
|
| 1389 |
+
Arrastra y suelta o haz clic para seleccionar tu archivo de turbina eólica
|
| 1390 |
+
</p>
|
| 1391 |
+
</div>
|
| 1392 |
+
<div style="background: #fff3e0; border-radius: 12px; padding: 20px; border-left: 4px solid #ff9800;">
|
| 1393 |
+
<h4 style="color: #ef6c00; margin: 0 0 10px 0; font-weight: 600; display: flex; align-items: center; gap: 8px;">
|
| 1394 |
+
<span style="font-size: 18px;">3️⃣</span> Analizar
|
| 1395 |
+
</h4>
|
| 1396 |
+
<p style="color: #f57c00; margin: 0; font-size: 14px; line-height: 1.4;">
|
| 1397 |
+
Haz clic en "Analizar" para iniciar la detección automática con IA
|
| 1398 |
+
</p>
|
| 1399 |
+
</div>
|
| 1400 |
+
<div style="background: #f3e5f5; border-radius: 12px; padding: 20px; border-left: 4px solid #9c27b0;">
|
| 1401 |
+
<h4 style="color: #7b1fa2; margin: 0 0 10px 0; font-weight: 600; display: flex; align-items: center; gap: 8px;">
|
| 1402 |
+
<span style="font-size: 18px;">4️⃣</span> Revisar
|
| 1403 |
+
</h4>
|
| 1404 |
+
<p style="color: #8e24aa; margin: 0; font-size: 14px; line-height: 1.4;">
|
| 1405 |
+
Examina las detecciones y el análisis profesional generado
|
| 1406 |
+
</p>
|
| 1407 |
+
</div>
|
| 1408 |
+
</div>
|
| 1409 |
</div>
|
| 1410 |
""")
|
| 1411 |
|
| 1412 |
# Input section: tabs for different media types
|
| 1413 |
with gr.Tabs() as media_tabs:
|
| 1414 |
# Video tab: only video input
|
| 1415 |
+
with gr.TabItem("🎥 Análisis de Vídeo"):
|
| 1416 |
gr.HTML("""
|
| 1417 |
+
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 30px; border-radius: 16px; margin-bottom: 25px; box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3); border: 2px solid rgba(255,255,255,0.2);">
|
| 1418 |
+
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 15px;">
|
| 1419 |
+
<span style="background: rgba(255,255,255,0.2); color: white; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; backdrop-filter: blur(10px);">🎬</span>
|
| 1420 |
+
<div>
|
| 1421 |
+
<h4 style="margin: 0; color: #ffffff !important; font-weight: 700 !important; font-size: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3) !important;">
|
| 1422 |
+
Análisis de Vídeo de Inspección
|
| 1423 |
+
</h4>
|
| 1424 |
+
<p style="color: rgba(255,255,255,0.9) !important; margin: 5px 0 0 0; font-weight: 500 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.2) !important;">
|
| 1425 |
+
Detección automática frame por frame con IA avanzada
|
| 1426 |
+
</p>
|
| 1427 |
+
</div>
|
| 1428 |
+
</div>
|
| 1429 |
+
<div style="background: rgba(255,255,255,0.1); border-radius: 10px; padding: 15px; backdrop-filter: blur(5px);">
|
| 1430 |
+
<p style="color: #ffffff !important; margin: 0; font-weight: 600 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.2) !important; font-size: 14px;">
|
| 1431 |
+
📁 <strong>Formatos:</strong> MP4, MOV, AVI, MKV | 📏 <strong>Tamaño máximo:</strong> 500MB | ⏱️ <strong>Duración:</strong> hasta 10 minutos
|
| 1432 |
+
</p>
|
| 1433 |
+
</div>
|
| 1434 |
</div>
|
| 1435 |
""")
|
| 1436 |
video_input = gr.Video(
|
| 1437 |
+
label="📤 Arrastra tu vídeo aquí o haz clic para seleccionar",
|
| 1438 |
+
height=300
|
| 1439 |
)
|
| 1440 |
|
| 1441 |
# Imagen tab: only image input
|
| 1442 |
+
with gr.TabItem("📸 Análisis de Imagen"):
|
| 1443 |
gr.HTML("""
|
| 1444 |
+
<div style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); padding: 30px; border-radius: 16px; margin-bottom: 25px; box-shadow: 0 8px 32px rgba(240, 147, 251, 0.3); border: 2px solid rgba(255,255,255,0.2);">
|
| 1445 |
+
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 15px;">
|
| 1446 |
+
<span style="background: rgba(255,255,255,0.2); color: white; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; backdrop-filter: blur(10px);">📷</span>
|
| 1447 |
+
<div>
|
| 1448 |
+
<h4 style="margin: 0; color: #ffffff !important; font-weight: 700 !important; font-size: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3) !important;">
|
| 1449 |
+
Análisis de Imagen de Inspección
|
| 1450 |
+
</h4>
|
| 1451 |
+
<p style="color: rgba(255,255,255,0.9) !important; margin: 5px 0 0 0; font-weight: 500 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.2) !important;">
|
| 1452 |
+
Detección precisa de defectos en alta resolución
|
| 1453 |
+
</p>
|
| 1454 |
+
</div>
|
| 1455 |
+
</div>
|
| 1456 |
+
<div style="background: rgba(255,255,255,0.1); border-radius: 10px; padding: 15px; backdrop-filter: blur(5px);">
|
| 1457 |
+
<p style="color: #ffffff !important; margin: 0; font-weight: 600 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.2) !important; font-size: 14px;">
|
| 1458 |
+
📁 <strong>Formatos:</strong> JPG, PNG, BMP, WEBP | 📏 <strong>Resolución:</strong> mínimo 1024x768px | 💾 <strong>Tamaño:</strong> hasta 50MB
|
| 1459 |
+
</p>
|
| 1460 |
+
</div>
|
| 1461 |
</div>
|
| 1462 |
""")
|
| 1463 |
image_input = gr.Image(
|
| 1464 |
type="filepath",
|
| 1465 |
+
label="📤 Arrastra tu imagen aquí o haz clic para seleccionar",
|
| 1466 |
+
height=300
|
| 1467 |
)
|
| 1468 |
# Configuración tab: classes and sensitivity controls
|
| 1469 |
with gr.TabItem("Configuración Avanzada"):
|
|
|
|
| 1662 |
</div>
|
| 1663 |
""")
|
| 1664 |
|
| 1665 |
+
# Botón de análisis mejorado y más prominente
|
| 1666 |
+
gr.HTML("""
|
| 1667 |
+
<div style="text-align: center; margin: 30px 0 20px 0;">
|
| 1668 |
+
<div style="background: linear-gradient(135deg, #28a745 0%, #20c997 100%); border-radius: 16px; padding: 20px; box-shadow: 0 8px 32px rgba(40, 167, 69, 0.3); border: 2px solid rgba(255,255,255,0.2);">
|
| 1669 |
+
<h3 style="color: white; margin: 0 0 10px 0; font-weight: 700; text-shadow: 2px 2px 4px rgba(0,0,0,0.3);">
|
| 1670 |
+
🚀 ¿Listo para el Análisis?
|
| 1671 |
+
</h3>
|
| 1672 |
+
<p style="color: rgba(255,255,255,0.9); margin: 0; font-weight: 500; text-shadow: 1px 1px 2px rgba(0,0,0,0.2);">
|
| 1673 |
+
Haz clic en el botón para iniciar la detección automática con IA
|
| 1674 |
+
</p>
|
| 1675 |
+
</div>
|
| 1676 |
+
</div>
|
| 1677 |
+
""")
|
| 1678 |
+
|
| 1679 |
btn_detect = gr.Button(
|
| 1680 |
+
"🔍 Iniciar Análisis con KESHERAT AI",
|
| 1681 |
+
variant="primary",
|
| 1682 |
+
size="lg",
|
| 1683 |
+
scale=1
|
| 1684 |
)
|
| 1685 |
|
| 1686 |
+
# Animación de carga mejorada y más amigable
|
| 1687 |
loading_status = gr.HTML(visible=False)
|
| 1688 |
|
| 1689 |
# Paleta de colores siempre visible para referencia rápida
|
|
|
|
| 1797 |
json_video = gr.JSON(visible=False)
|
| 1798 |
json_image = gr.JSON(visible=False)
|
| 1799 |
|
| 1800 |
+
# Funciones auxiliares eliminadas - ahora usamos process_media_unified
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1801 |
|
| 1802 |
# Función unificada para manejar tanto video como imagen
|
| 1803 |
def process_media_unified(video_file, image_file):
|
|
|
|
| 1884 |
btn_enter.click(fn=_check_token, inputs=[gate_token], outputs=[gate_group, app_group, gate_status])
|
| 1885 |
|
| 1886 |
# Habilitar cola para ZeroGPU
|
| 1887 |
+
# Footer informativo y amigable
|
| 1888 |
+
gr.HTML("""
|
| 1889 |
+
<div style="background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); border-top: 3px solid #dee2e6; padding: 30px; margin-top: 40px; text-align: center; border-radius: 0 0 20px 20px;">
|
| 1890 |
+
<div style="max-width: 800px; margin: 0 auto;">
|
| 1891 |
+
<h4 style="color: #495057; margin-bottom: 20px; font-weight: 700; font-size: 18px;">
|
| 1892 |
+
💡 Consejos para Mejores Resultados
|
| 1893 |
+
</h4>
|
| 1894 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px;">
|
| 1895 |
+
<div style="background: #ffffff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 1896 |
+
<div style="font-size: 24px; margin-bottom: 10px;">📸</div>
|
| 1897 |
+
<h5 style="color: #212529; margin-bottom: 8px; font-weight: 600;">Calidad de Imagen</h5>
|
| 1898 |
+
<p style="color: #6c757d; margin: 0; font-size: 13px; line-height: 1.4;">
|
| 1899 |
+
Usa imágenes nítidas y bien iluminadas para mejores detecciones
|
| 1900 |
+
</p>
|
| 1901 |
+
</div>
|
| 1902 |
+
<div style="background: #ffffff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 1903 |
+
<div style="font-size: 24px; margin-bottom: 10px;">🎯</div>
|
| 1904 |
+
<h5 style="color: #212529; margin-bottom: 8px; font-weight: 600;">Enfoque Cercano</h5>
|
| 1905 |
+
<p style="color: #6c757d; margin: 0; font-size: 13px; line-height: 1.4;">
|
| 1906 |
+
Acércate a las áreas de interés para análisis más precisos
|
| 1907 |
+
</p>
|
| 1908 |
+
</div>
|
| 1909 |
+
<div style="background: #ffffff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 1910 |
+
<div style="font-size: 24px; margin-bottom: 10px;">⚙️</div>
|
| 1911 |
+
<h5 style="color: #212529; margin-bottom: 8px; font-weight: 600;">Configuración</h5>
|
| 1912 |
+
<p style="color: #6c757d; margin: 0; font-size: 13px; line-height: 1.4;">
|
| 1913 |
+
Ajusta la sensibilidad según tus necesidades específicas
|
| 1914 |
+
</p>
|
| 1915 |
+
</div>
|
| 1916 |
+
</div>
|
| 1917 |
+
<div style="border-top: 1px solid #dee2e6; padding-top: 20px;">
|
| 1918 |
+
<p style="color: #6c757d; margin: 0; font-size: 14px; font-weight: 500;">
|
| 1919 |
+
🚀 <strong>KESHERAT AI</strong> - Sistema Inteligente de Inspección para Turbinas Eólicas
|
| 1920 |
+
</p>
|
| 1921 |
+
<p style="color: #adb5bd; margin: 5px 0 0 0; font-size: 12px;">
|
| 1922 |
+
Tecnología avanzada de IA para detección automática de defectos
|
| 1923 |
+
</p>
|
| 1924 |
+
</div>
|
| 1925 |
+
</div>
|
| 1926 |
+
</div>
|
| 1927 |
+
""")
|
| 1928 |
+
|
| 1929 |
demo.queue()
|
| 1930 |
|
| 1931 |
if __name__ == "__main__":
|