iamomtiwari commited on
Commit
14cb169
·
verified ·
1 Parent(s): 2aefdcc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import gradio as gr
3
+ from arima_forecast import forecast
4
+
5
+ def run_forecast(comm_code):
6
+ pred, actual, mape = forecast(comm_code=int(comm_code))
7
+ result_df = actual.to_frame(name="Actual")
8
+ result_df["Forecast"] = pred
9
+ return result_df, f"MAPE (Accuracy): {round(mape*100, 2)}%"
10
+
11
+ iface = gr.Interface(
12
+ fn=run_forecast,
13
+ inputs=gr.Textbox(label="Enter COMM_CODE (e.g., 13011000)"),
14
+ outputs=[
15
+ gr.Dataframe(label="Forecast vs Actual"),
16
+ gr.Text(label="Accuracy")
17
+ ],
18
+ title="Commodity Price Forecast (ARIMA)",
19
+ description="Enter a commodity code to forecast next 6 months using ARIMA."
20
+ )
21
+
22
+ iface.launch()