Spaces:
Sleeping
Sleeping
Download app.py from construfull/EN-CONSTRUCCION: direct link, hf CLI and curl.
- Browser
- Download file 8.36 kB
-
https://huggingface.co/spaces/construfull/EN-CONSTRUCCION/resolve/main/app.py
- Command line
-
hf download hf://spaces/construfull/EN-CONSTRUCCION/app.py
-
curl -L -o app.py https://huggingface.co/spaces/construfull/EN-CONSTRUCCION/resolve/main/app.py
8.36 kB
| import gradio as gr | |
| import urllib.parse | |
| import time | |
| def ejecutar_protocolo_shanghai(tipo_proyecto, objetivo, foto, nombre, telefono, descripcion): | |
| if not nombre or not telefono: | |
| return ( | |
| "🚨 [ERROR DE AUTENTICACIÓN] Por favor ingresa Nombre y WhatsApp para activar el escáner.", | |
| "<div style='text-align:center; color:#EF4444;'>Falta información de contacto.</div>" | |
| ) | |
| # 🏎️ SIMULACIÓN DE PROCESAMIENTO ASIÁTICO (Genera el efecto WOW de espera técnica) | |
| time.sleep(2.5) | |
| # Lógica de cálculo dinámico "juguetón" estilo app china | |
| material_estimado = "85 kg de Microcemento Nanotech + Base Polimérica" if "Microcemento" in tipo_proyecto else "Kits de Anclaje Estructural + Aditivos" | |
| if "Baño" in tipo_proyecto: material_estimado = "Sistemas de Impermeabilización Avanzada + Acabados Epóxicos" | |
| if "Cocina" in tipo_proyecto: material_estimado = "Módulos de Alta Resistencia Térmica y Superficies de Cuarzo" | |
| # Consola técnica para la interfaz | |
| informe_ui = f"""⚡ EN CONSTRUCCIÓN LAB · AUTOMATION TOKYO-ENGINE | |
| ====================================================== | |
| [NIVEL DE USUARIO]: S-RANK CONSTRUCTOR 🔥 | |
| [ID PROYECTO]: CN-MED-{int(time.time())} | |
| ► MATRIZ SELECCIONADA: {tipo_proyecto} | |
| ► VECTOR DE OPERACIÓN: {objetivo} | |
| ► CÁLCULO DE MATERIALES PREDICTIVO: | |
| {material_estimado} | |
| ► ESTADO GLOBAL: ¡PROCESADO CON ÉXITO! | |
| ====================================================== | |
| ¡Felicidades {nombre}! Has desbloqueado un beneficio exclusivo.""" | |
| # Mensaje persuasivo y ultra-comercial para WhatsApp | |
| mensaje_wa = f"""*¡ALERTA DE PROYECTO PREMIUM - EN CONSTRUCCIÓN LAB!* 🧪🔥 | |
| _Ecosistema de Conversión Rápida de Construfull_ | |
| 👤 *Constructor:* {nombre} | |
| 📞 *Línea Directa:* {telefono} | |
| 📐 *Matriz:* {tipo_proyecto} | |
| 🎯 *Meta:* {objetivo} | |
| 📦 *Sustratos e Insumos Estimados:* | |
| _{material_estimado}_ | |
| 🎁 *RECOMPENSA ACTIVA:* Ha reclamado el *Bono de Auditoría Express* + Muestra Física de Microcemento en ExpoCamaCol. | |
| --- | |
| 🚀 _Enviado desde el Laboratorio del Futuro_""" | |
| mensaje_codificado = urllib.parse.quote(mensaje_wa) | |
| link = f"https://wa.me/573233476985?text={mensaje_codificado}" | |
| # RECOMPENSA ESTILO CUUPÓN CHINO (Llamativo, con urgencia y botones de acción) | |
| cupon_html = f""" | |
| <div class="china-coupon-card"> | |
| <div class="coupon-left"> | |
| <h2>RECOMPENSA</h2> | |
| <p>CONSTRUFULL SAS</p> | |
| </div> | |
| <div class="coupon-right"> | |
| <h3>AUDITORÍA TÉCNICA 100% GRATIS</h3> | |
| <p style="color: #94A3B8; font-size: 11px;">Válido por las próximas 2 horas para {nombre}</p> | |
| <a href="{link}" target="_blank" style="text-decoration: none;"> | |
| <button class="btn-china-claim">🎯 RECLAMAR BENEFICIO EN WHATSAPP</button> | |
| </a> | |
| </div> | |
| </div> | |
| """ | |
| return informe_ui, cupon_html | |
| # 🧧 CSS AL ESTILO SUPER-APP (Neón, Contraste Alto, Efectos Táctiles Masivos) | |
| custom_css = """ | |
| body, .gradio-container { background-color: #060814 !important; color: #F1F5F9 !important; font-family: 'Inter', sans-serif !important; } | |
| .tabs, .box, .input-container, input, textarea, select { background-color: #0B0F19 !important; border: 2px solid #1E293B !important; color: white !important; } | |
| label { color: #10B981 !important; font-weight: 900 !important; font-family: monospace !important; font-size: 13px !important; } | |
| /* 🎮 CASILLAS DE SELECCIÓN GAMIFICADAS */ | |
| .gradio-container .gr-input-label { | |
| background: linear-gradient(135deg, #111827 0%, #0F172A 100%) !important; | |
| border: 2px solid #1F2937 !important; | |
| border-radius: 14px !important; | |
| padding: 16px !important; | |
| font-weight: bold !important; | |
| transition: all 0.2s ease-in-out !important; | |
| } | |
| .gradio-container .gr-input-label:hover { | |
| border-color: #10B981 !important; /* Verde Neón de éxito financiero */ | |
| transform: scale(1.03) !important; | |
| background: #064E3B !important; | |
| box-shadow: 0 0 15px rgba(16, 185, 129, 0.3) !important; | |
| } | |
| /* BOTÓN DE DISPARO INMEDIATO */ | |
| button.primary { | |
| background: linear-gradient(90deg, #F59E0B 0%, #EF4444 100%) !important; /* Degradado de energía asiático */ | |
| border: none !important; | |
| color: white !important; | |
| font-weight: 900 !important; | |
| font-size: 16px !important; | |
| letter-spacing: 1px !important; | |
| border-radius: 50px !important; | |
| padding: 18px !important; | |
| box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4) !important; | |
| } | |
| button.primary:hover { | |
| transform: translateY(-2px) scale(1.02); | |
| box-shadow: 0 6px 25px rgba(239, 68, 68, 0.6) !important; | |
| } | |
| /* 🧧 DISEÑO DEL CUPÓN CHINO DE CONVERSIÓN RÁPIDA */ | |
| .china-coupon-card { | |
| display: flex; | |
| background: #111827; | |
| border: 2px dashed #EF4444; | |
| border-radius: 12px; | |
| overflow: hidden; | |
| max-width: 500px; | |
| margin: 15px auto; | |
| box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15); | |
| } | |
| .coupon-left { | |
| background: linear-gradient(135deg, #EF4444 0%, #991B1B 100%); | |
| color: white; | |
| padding: 20px; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| min-width: 130px; | |
| } | |
| .coupon-left h2 { margin: 0; font-size: 18px; font-weight: 900; letter-spacing: 1px; } | |
| .coupon-left p { margin: 5px 0 0 0; font-size: 10px; opacity: 0.8; font-family: monospace; } | |
| .coupon-right { | |
| padding: 20px; | |
| text-align: left; | |
| flex-grow: 1; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| } | |
| .coupon-right h3 { margin: 0; color: #10B981; font-size: 16px; font-weight: 800; } | |
| .btn-china-claim { | |
| background: #10B981; | |
| color: white; | |
| border: none; | |
| padding: 10px 15px; | |
| font-weight: bold; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| width: 100%; | |
| margin-top: 10px; | |
| transition: background 0.2s; | |
| } | |
| .btn-china-claim:hover { background: #059669; } | |
| footer { display: none !important; } | |
| """ | |
| with gr.Blocks(theme=gr.themes.Base(), css=custom_css) as demo: | |
| # Banner superior estilo transmisión en vivo / Gamificado | |
| gr.Markdown(""" | |
| # 🧪 EN CONSTRUCCIÓN | INTERACTIVE LAB | |
| ### 🚀 PROTOCOLO ACELERADO DE TRANSFORMACIÓN · CONSTRUFULL MEDELLÍN SAS | |
| --- | |
| 🔴 **USUARIOS ACTIVOS EN MEDELLÍN:** 42 diagnosticando ahora mismo... ¡Completa el tuyo y asegura beneficios! | |
| """) | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| gr.Markdown("### [PASO 01] SELECCIONA EL NÚCLEO DE LA OBRA") | |
| tipo_proyecto = gr.Radio( | |
| choices=["🛁 Módulo Baño Inteligente", "🍳 Módulo Cocina de Lujo", "✨ Superficie de Microcemento", "🏢 Rediseño Comercial Completo"], | |
| label="Matriz de Entrada", show_label=False | |
| ) | |
| gr.Markdown("### [PASO 02] DEFINE EL IMPACTO") | |
| objetivo = gr.Radio( | |
| choices=["✨ Estética Disruptiva", "🔧 Reparación y Diagnóstico Clínico", "📈 Multiplicar Valor de Reventa"], | |
| label="Impacto del Algoritmo", show_label=False | |
| ) | |
| with gr.Column(scale=1): | |
| gr.Markdown("### [PASO 03] REGISTRO Y MONITOREO") | |
| foto = gr.Image(label="Escanear Espacio Actual (Opcional)", type="filepath") | |
| nombre = gr.Textbox(label="Tu Nombre (Para asignar el Bono)", placeholder="Ej. Carlos Mendoza") | |
| telefono = gr.Textbox(label="WhatsApp de Enlace Inmediato", placeholder="Ej. 3001234567") | |
| descripcion = gr.Textbox(label="Especificaciones Técnicas Libres", placeholder="Añade detalles especiales aquí...", lines=2) | |
| # El gran botón asiático de conversión masiva | |
| boton_ejecutar = gr.Button("⚡ COMPILAR DATOS Y RECLAMAR PREMIO ⚡", variant="primary") | |
| gr.Markdown("---") | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| informe_salida = gr.Textbox( | |
| label="🖥️ CORE CONSOLE (ALGORITMO PREDICTIVO DE MATERIALES)", | |
| lines=8, | |
| interactive=False | |
| ) | |
| with gr.Column(scale=1): | |
| whatsapp_salida = gr.HTML() | |
| boton_ejecutar.click( | |
| fn=ejecutar_protocolo_shanghai, | |
| inputs=[tipo_proyecto, objetivo, foto, nombre, telefono, descripcion], | |
| outputs=[informe_salida, whatsapp_salida] | |
| ) | |
| demo.launch() |