doctorlinux commited on
Commit
5fb9fb8
·
verified ·
1 Parent(s): 9a080bb

Upload 2 files

Browse files
Files changed (2) hide show
  1. app2.py +84 -0
  2. requirements.txt +2 -0
app2.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ **🕐 Última actualización:** {time.strftime('%H:%M:%S')}
5
+ **🔧 Estado:** Conexión SSH establecida correctamente
6
+ **📡 Equipo:** Ubiquiti ({ip})
7
+
8
+ > 💡 *Nota: Estamos mostrando métricas crudas. En la siguiente versión las parsearemos mejor.*
9
+ """
10
+
11
+ except Exception as e:
12
+ return f"""
13
+ # ❌ **ERROR DE CONEXIÓN**
14
+
15
+ **IP:** {ip}
16
+ **Error:** {str(e)}
17
+
18
+ ## 🔍 **POSIBLES SOLUCIONES:**
19
+ 1. Verifica que la IP sea correcta
20
+ 2. Confirma usuario/contraseña
21
+ 3. Asegura que el equipo esté encendido
22
+ 4. Verifica conectividad de red
23
+
24
+ **🕐 Hora del error:** {time.strftime('%H:%M:%S')}
25
+ """
26
+
27
+ # INTERFAZ GRADIO
28
+ with gr.Blocks(title="Test Antena Ubiquiti - DoctorLinux", theme=gr.themes.Soft()) as demo:
29
+ gr.Markdown("""
30
+ # 📡 Test de Calidad - Antena Ubiquiti Remota
31
+ ### **DoctorLinux.com** - Monitoreo en Tiempo Real
32
+ """)
33
+
34
+ with gr.Row():
35
+ with gr.Column(scale=1):
36
+ gr.Markdown("### 🔐 Credenciales del Equipo")
37
+ ip_input = gr.Textbox(
38
+ label="IP del Equipo",
39
+ placeholder="ej: 192.168.1.20",
40
+ value=""
41
+ )
42
+ usuario_input = gr.Textbox(
43
+ label="Usuario",
44
+ placeholder="ej: ubnt",
45
+ value="ubnt"
46
+ )
47
+ password_input = gr.Textbox(
48
+ label="Contraseña",
49
+ type="password",
50
+ placeholder="Ingresa la contraseña",
51
+ value=""
52
+ )
53
+ test_btn = gr.Button(
54
+ "🚀 Ejecutar Test de Conectividad",
55
+ variant="primary",
56
+ size="lg"
57
+ )
58
+
59
+ with gr.Column(scale=2):
60
+ gr.Markdown("### 📊 Resultados del Test")
61
+ resultado_output = gr.Markdown(
62
+ label="Resultados",
63
+ value="**Ingresa los datos del equipo y haz clic en 'Ejecutar Test'**"
64
+ )
65
+
66
+ gr.Markdown("---")
67
+ gr.Markdown("""
68
+ ### 💡 **Información importante:**
69
+ - Este test verifica conectividad SSH con equipos Ubiquiti
70
+ - Obtenemos métricas reales usando comandos del fabricante
71
+ - Los datos NO se almacenan, solo se muestran en tiempo real
72
+ - Requiere que el equipo tenga SSH habilitado
73
+ """)
74
+
75
+ # Conectar el botón
76
+ test_btn.click(
77
+ fn=test_antena_remota,
78
+ inputs=[ip_input, usuario_input, password_input],
79
+ outputs=resultado_output
80
+ )
81
+
82
+ # Ejecutar la aplicación
83
+ if __name__ == "__main__":
84
+ demo.launch(share=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio>=4.0.0
2
+ paramiko>=3.0.0