Spaces:
Sleeping
Sleeping
File size: 2,503 Bytes
bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 07e4611 bdfa8a5 | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | # ruff: noqa: F403, F405
import streamlit as st
import pandas as pd
from chronos_conference.domain.inference import get_forecast
from chronos_conference.adapters.filter_ts import filter_ts, get_properties
from chronos_conference.adapters.model_instance import ChronosForecaster
from chronos_conference.adapters.ts_plot import get_plot
from chronos_conference.settings import *
st.title("AWS Community Day Ecuador 2025")
st.header(
"Conferencia: Aprendiendo el Lenguaje de las series de tiempo con AWS Chronos Bolt"
)
st.subheader("Ponente: Sebastian Sarasti")
st.write(
"""
Esta aplicación demuestra cómo utilizar AWS Chronos Bolt para la predicción del clima mediante
datos abiertos obtenidos del INAMHI.
"""
)
df = pd.read_parquet(PATH_DATA)
col1, col2 = st.columns(2)
with col1:
min_date = st.date_input("Fecha mínima", value=MIN_PRED_DATE)
with col2:
max_date = st.date_input("Fecha máxima", value=MAX_PRED_DATE)
city_choice = st.selectbox(
"Seleccione la zona de la ciudad a predecir", ZONES_TO_PREDICT
)
if not city_choice:
st.stop()
available_properties = get_properties(df, ZONE_COL, city_choice)
if not available_properties:
st.stop()
col1, col2 = st.columns(2)
with col1:
property_choice = st.pills(
"Seleccione la propiedad a predecir",
available_properties,
selection_mode="multi",
)
with col2:
n_steps = st.number_input(
"Número de pasos a predecir",
min_value=MIN_PRED_DATE_LIMIT,
max_value=MAX_PRED_DATE_LIMIT,
value=N_PRED_STEPS,
)
if not property_choice:
st.stop()
execution_button = st.button("Ejecutar modelo")
if not execution_button:
st.stop()
with st.spinner("Filtrando datos..."):
df_useful = filter_ts(
df,
date_col=HISTORICAL_DATE_COLUMN,
min_date=str(min_date),
max_date=str(max_date),
city_col=ZONE_COL,
city_choice=city_choice,
property_col=HISTORICAL_ITEM_COLUMN,
property_choice=property_choice,
)
model = ChronosForecaster(freq=FREQUENCY)
with st.spinner("Modelo en ejecución..."):
results = get_forecast(
df=df_useful,
date_col=HISTORICAL_DATE_COLUMN,
target_col=HISTORICAL_TARGET_COLUMN,
item_col=HISTORICAL_ITEM_COLUMN,
model_instance=model,
)
st.success("¡Ejecución completada!")
st.write("Resultados de la ejecución:")
fig = get_plot(df_useful, results)
st.plotly_chart(fig, use_container_width=True)
|