Spaces:
Runtime error
Runtime error
from get_forecast import get_forecast | |
import gradio as gr | |
with gr.Blocks() as demo: | |
gr.Markdown( | |
""" | |
# AB InBev Data Science Challenge | |
Welcome to the AB InBev Data Science Challenge demo! This interactive tool is designed to help you forecast the **SOM** and **Volume** series on **Market_004**, and analyze their price sensitivity. | |
## How to use this demo? | |
Using this demo is simple and straightforward. Just follow these steps: | |
1. Select the series you want to forecast from the dropdown menu. The valid options are **SOM** and **Volume**. | |
2. Specify the number of months ahead for your forecast. | |
3. Choose the desired price variation compared to the previous year. A value of 0 indicates that the future price values will be the same as the previous year. | |
That's it! You're ready to explore and analyze the forecasted series. Enjoy! | |
""") | |
with gr.Row(): | |
serie = gr.Dropdown(choices = ['SOM', 'Volumen'], value = 'SOM', label = 'Serie', info = 'Choose the serie to forecast') | |
periods = gr.Slider(minimum = 1, maximum = 12, step = 1, value = 3, label = 'Months', info = 'How many months to forecast') | |
percent_change = gr.Slider(minimum = -100, maximum = 100, step = 5, value = -5, label = 'Price change', info = "Price change vs last year (%)") | |
with gr.Row(): | |
dataframe = gr.Dataframe(label = 'Predicted values') | |
plot = gr.Plot(label = 'Forecast curve') | |
serie.change(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
periods.change(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
percent_change.change(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
plot.change(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
dataframe.change(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
demo.load(get_forecast, [serie, periods, percent_change], [plot, dataframe], queue=False) | |
demo.launch(debug = False) |