Spaces:
Runtime error
Runtime error
Commit ·
caac0d2
1
Parent(s): 5a90d43
update 16
Browse files254 unmodified lines2552562572582592602611 unmodified line2632642652662672682692702712722732742752762772782792802812822832842852 unmodified lines2882892902912922932941 unmodified line2962972982993003013021 unmodified line3043053063073083093103113123132 unmodified lines316317318319320321322323324325326327328329330331332333334335336337338339340341342343344254 unmodified linesexcept Exception as e:print("Error al enviar a Getform:", e)# ------------------------- INTERFAZ CON CSS PERSONALIZADO (SIN LOGO) -------------------------css = f"""body {{1 unmodified linebackground-color: {color_fondo};color: {color_texto_principal};}}#teo-container {{ /* Nuevo ID para el contenedor principal */width: 700px !important;max-width: 95% !important;margin: 30px auto !important;border: 1px solid #cccccc;border-radius: 10px;box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);padding: 20px !important;background-color: white;}}#teo-title {{color: {color_principal};text-align: center;margin-bottom: 20px;font-size: 2em;}}#chatbot-area {{border: 1px solid #e0e0e0;border-radius: 8px;padding: 15px;2 unmodified linesoverflow-y: auto;max-height: 500px;}}.user-message {{background-color: {color_secundario_medio_claro};color: {color_texto_principal};border-radius: 8px;1 unmodified linemargin-bottom: 8px;text-align: right;}}.bot-message {{background-color: {color_principal};color: white;border-radius: 8px;1 unmodified linemargin-bottom: 8px;text-align: left;}}#textbox-container {{margin-bottom: 15px;}}.submit-button {{background-color: {color_secundario_oscuro};color: white !important;border: none;2 unmodified linescursor: pointer;font-weight: bold;}}.submit-button:hover {{background-color: {color_principal};}}"""with gr.Blocks(css=css) as iface:with gr.Column(elem_id="teo-container"):gr.Markdown("<h1 id='teo-title'>🤖 Soy TEO el asistente digital de Equitas Consultora</h1>")chatbot = gr.Chatbot(elem_id="chatbot-area", show_label=False)msg = gr.Textbox(placeholder="Escribe aquí...")btn = gr.Button("Enviar", elem_id="submit-button")estado_salida = gr.State(estado)def respond(message, chat_history, current_state):global estadoestado = current_statebot_message = teo(message, [list(pair) for pair in chat_history])chat_history.append((message, bot_message))return "", chat_history, estadobtn.click(respond, [msg, chatbot, estado_salida], [msg, chatbot, estado_salida])msg.submit(respond, [msg, chatbot, estado_salida], [msg, chatbot, estado_salida])iface.launch()254 unmodified lines2552562572582592602612622631 unmodified line2652662672682692702712722732742752762772782792802812822832842852862872 unmodified lines2902912922932942952961 unmodified line2982993003013023033041 unmodified line3063073083093103113123133143152 unmodified lines318319320321322323324325326327328329330331332333334335336254 unmodified linesexcept Exception as e:print("Error al enviar a Getform:", e)# ------------------------- INTERFAZ CON CSS PERSONALIZADO Y LOGO -------------------------logo_url = "URL_DEL_LOGO_DE_EQUITAS" # ¡REEMPLAZA CON LA URL DE TU LOGO!css = f"""body {{1 unmodified linebackground-color: {color_fondo};color: {color_texto_principal};}}.gradio-container {{width: 700px !important; /* Ancho fijo para la "app" */max-width: 95% !important; /* Adaptabilidad en pantallas pequeñas */margin: 30px auto !important; /* Centrar y dar margen */border: 1px solid #cccccc;border-radius: 10px;box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);padding: 20px !important;background-color: white;}}.chat-interface-title {{color: {color_principal};text-align: center;margin-bottom: 20px;font-size: 2em;}}.chatbot {{border: 1px solid #e0e0e0;border-radius: 8px;padding: 15px;2 unmodified linesoverflow-y: auto;max-height: 500px;}}.chatbot-row.user {{background-color: {color_secundario_medio_claro};color: {color_texto_principal};border-radius: 8px;1 unmodified linemargin-bottom: 8px;text-align: right;}}.chatbot-row.bot {{background-color: {color_principal};color: white;border-radius: 8px;1 unmodified linemargin-bottom: 8px;text-align: left;}}.textbox-container {{margin-bottom: 15px;}}.gr-button {{background-color: {color_secundario_oscuro};color: white !important;border: none;2 unmodified linescursor: pointer;font-weight: bold;}}.gr-button:hover {{background-color: {color_principal};}}"""header_html = f'<div style="display: flex; justify-content: center; align-items: center; margin-bottom: 15px;"><img src="{logo_url}" style="max-height: 80px;"></div>'iface = gr.ChatInterface(fn=teo,title="🤖 Soy TEO el asistente digital de Equitas Consultora",description="¡Conversemos!",css=css,header=header_html)iface.launch()
app.py+23-31