File size: 2,076 Bytes
c97655d
 
 
 
 
 
 
 
08e016d
 
 
 
 
 
54df5db
08e016d
c97655d
 
 
 
d1a9040
 
c97655d
0040742
 
d1a9040
c97655d
e092ae3
 
 
 
0040742
e092ae3
c97655d
 
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
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, 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 = '% Change vs Last Year', 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)