File size: 657 Bytes
14cb169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# app.py
import gradio as gr
from arima_forecast import forecast

def run_forecast(comm_code):
    pred, actual, mape = forecast(comm_code=int(comm_code))
    result_df = actual.to_frame(name="Actual")
    result_df["Forecast"] = pred
    return result_df, f"MAPE (Accuracy): {round(mape*100, 2)}%"

iface = gr.Interface(
    fn=run_forecast,
    inputs=gr.Textbox(label="Enter COMM_CODE (e.g., 13011000)"),
    outputs=[
        gr.Dataframe(label="Forecast vs Actual"),
        gr.Text(label="Accuracy")
    ],
    title="Commodity Price Forecast (ARIMA)",
    description="Enter a commodity code to forecast next 6 months using ARIMA."
)

iface.launch()