Spaces:
Sleeping
Sleeping
File size: 3,286 Bytes
4239713 ed58e51 4239713 b968445 4239713 b968445 4239713 604e661 3aea732 604e661 4129a65 604e661 b968445 604e661 b968445 604e661 b968445 604e661 b968445 604e661 b968445 3aea732 b968445 604e661 b968445 604e661 b968445 3aea732 ed58e51 b968445 4239713 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | import numpy as np
import gradio as gr
import MOD_V_TCOND_Z4_008C
import terrenos_2026 # Importa o arquivo ajustado
with gr.Blocks(title="Modelos Territoriais") as bloco:
with gr.Tabs():
# --- ABA 1: MODELO EXISTENTE ---
with gr.TabItem(MOD_V_TCOND_Z4_008C.title):
gr.Markdown(MOD_V_TCOND_Z4_008C.header_text)
with gr.Accordion("📋 Consultar Tabela de Infraestrutura (Clique para expandir)", open=False):
gr.Markdown(MOD_V_TCOND_Z4_008C.tabela_infra)
gr.HTML("<br>")
with gr.Row():
with gr.Column(scale=1, variant="panel"):
gr.Markdown("### ⚙️ Parâmetros de Entrada")
ATPRIV = gr.Number(value=168., label='Área de Terreno Privativa')
RH = gr.Number(value=38, label='Região Homogênea')
INFRA = gr.Number(value=5, label='Infraestrutura')
gr.Markdown("#### Anos de Referência")
with gr.Row():
with gr.Column():
ANO_2020 = gr.Checkbox(value=False, label='2020')
ANO_2021 = gr.Checkbox(value=False, label='2021')
ANO_2022 = gr.Checkbox(value=False, label='2022')
with gr.Column():
ANO_2023 = gr.Checkbox(value=False, label='2023')
ANO_2024 = gr.Checkbox(value=False, label='2024')
ANO_2025 = gr.Checkbox(value=True, label='2025')
text_button = gr.Button("🚀 Calcular Valor", variant="primary")
with gr.Column(scale=1):
gr.Markdown("### 📊 Resultados")
out_valor = gr.Textbox(label="Valor (R$/m²)", text_align="center")
with gr.Row():
out_lim_inf = gr.Textbox(label="Limite Inferior")
out_perc_inf = gr.Textbox(label="% Inf")
with gr.Row():
out_lim_sup = gr.Textbox(label="Limite Superior")
out_perc_sup = gr.Textbox(label="% Sup")
out_grafico = gr.Image(label="Gráfico", type="filepath")
gr.Markdown("### 🖨️ Exportação")
btn_pdf = gr.Button("📄 Gerar PDF", variant="secondary")
out_pdf = gr.File(label="Download", visible=False)
# Lógica da Aba 1
inputs_list = [ANO_2020, ANO_2021, ANO_2022, ANO_2023, ANO_2024, ANO_2025, RH, INFRA, ATPRIV]
outputs_list = [out_valor, out_lim_inf, out_perc_inf, out_lim_sup, out_perc_sup, out_grafico]
text_button.click(MOD_V_TCOND_Z4_008C.execute, inputs=inputs_list, outputs=outputs_list)
pdf_inputs = inputs_list + outputs_list
btn_pdf.click(MOD_V_TCOND_Z4_008C.gerar_pdf_relatorio, inputs=pdf_inputs, outputs=out_pdf)
# --- ABA 2: MODELO TERRITORIAL 2026 ---
with gr.TabItem("Avaliação de Terrenos (XGBoost)"):
terrenos_2026.render_terrenos_interface()
bloco.launch() |