Spaces:
Sleeping
Sleeping
| # app_04.py | |
| import os | |
| import dash | |
| from load_process import load_files | |
| from layout_01 import criar_layout | |
| from callbacks import registrar_callbacks | |
| from flask_caching import Cache | |
| from load_process import load_bairros, load_coleta, load_descartes | |
| print("📦 Carregando dados geoespaciais...") | |
| gdf_bairros = load_bairros() | |
| gdf_coleta = load_coleta() | |
| gdf_descartes = load_descartes() | |
| print("✅ Dados carregados") | |
| # Leitura dos dados | |
| #gdf_m,df_plot,list_feature,feat_options=load_files() #original | |
| gdf_m,df_plot,list_feature,feat_options,gdf_p =load_files(ponto_descarte=True) | |
| descriptions_map = { | |
| opt['value']: opt['description'] | |
| for opt in feat_options | |
| if opt.get('description') is not None | |
| } | |
| # APP | |
| app = dash.Dash(__name__) | |
| server = app.server #to render deploy | |
| # Inicialização do CACHE | |
| cache = Cache(server, config={ | |
| 'CACHE_TYPE': 'SimpleCache', | |
| 'CACHE_DEFAULT_TIMEOUT': 300 # segundos | |
| }) | |
| # Configurar layout | |
| app.layout = criar_layout(feat_options) | |
| # Registrar callbacks | |
| registrar_callbacks(app, df_plot, gdf_m,descriptions_map,gdf_p,cache) | |
| # if __name__ == '__main__': | |
| # app.run(debug=True, host='0.0.0.0', port=8050) | |
| # Execução local (ignorado por Gunicorn) | |
| if __name__ == '__main__': | |
| port = int(os.environ.get("PORT", 8050)) | |
| app.run(debug=False, host='0.0.0.0', port=port) |