Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""
|
3 |
+
Created on Sat Apr 23 20:23:23 2022
|
4 |
+
|
5 |
+
@author: kbpat
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pandas as pd
|
9 |
+
import streamlit as st
|
10 |
+
df1= pd.read_excel("INDIA INFLATION RATE.xlsx",names=('Year','IR','AC'),parse_dates=[0])
|
11 |
+
from statsmodels.tsa.stattools import adfuller
|
12 |
+
|
13 |
+
def adf_test(dataset):
|
14 |
+
dftest = adfuller(dataset, autolag = 'AIC')
|
15 |
+
print("1. ADF : ",dftest[0])
|
16 |
+
print("2. P-Value : ", dftest[1])
|
17 |
+
print("3. Num Of Lags : ", dftest[2])
|
18 |
+
print("4. Num Of Observations Used For ADF Regression and Critical Values Calculation :", dftest[3])
|
19 |
+
print("5. Critical Values :")
|
20 |
+
for key, val in dftest[4].items():
|
21 |
+
print("\t",key, ": ", val)
|
22 |
+
adf_test(df1['IR'])
|
23 |
+
from pmdarima import auto_arima
|
24 |
+
import warnings
|
25 |
+
warnings.filterwarnings("ignore")
|
26 |
+
stepwise_fit = auto_arima(df1['IR'], trace=True,
|
27 |
+
suppress_warnings=True)
|
28 |
+
stepwise_fit.summary()
|
29 |
+
prediction=stepwise_fit.predict()
|
30 |
+
print(prediction)
|
31 |
+
|
32 |
+
def main():
|
33 |
+
st.title("Model Deployment:Inflation Rate")
|
34 |
+
html_temp = """
|
35 |
+
<div style="background-color:tomato;padding:10px">
|
36 |
+
<h2 style="color:white;text-align:center;"> INFLATION RATE </h2>
|
37 |
+
</div>
|
38 |
+
"""
|
39 |
+
st.markdown(html_temp,unsafe_allow_html=True)
|
40 |
+
Inflation = st.text_input("Inflation","Type Here")
|
41 |
+
Year = st.text_input("Year","Type Here")
|
42 |
+
result=""
|
43 |
+
if st.button("Predict"):
|
44 |
+
result=prediction
|
45 |
+
st.success('The output is {}'.format(result))
|
46 |
+
if st.button("About"):
|
47 |
+
st.text("https://www.macrotrends.net/countries/IND/india/inflation-rate-cpi")
|
48 |
+
st.text("Built with Streamlit")
|
49 |
+
|
50 |
+
if __name__=='__main__':
|
51 |
+
main()
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
|