Spaces:
Runtime error
Runtime error
Commit
·
5bfe1bf
1
Parent(s):
fa62271
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import pandas as pd
|
|
9 |
import numpy as np
|
10 |
import cpi
|
11 |
from sklearn.preprocessing import MinMaxScaler
|
|
|
12 |
|
13 |
#cpi.update()
|
14 |
|
@@ -34,11 +35,11 @@ model = mr.get_model("stock_price_modal")
|
|
34 |
#m = hf_hub_download(repo_id="marvmk/model-test", filename="model.pkl")
|
35 |
#model = pickle.load(open(m, 'rb'))
|
36 |
|
37 |
-
|
38 |
-
m=model_dir + "stock_model.pkl"
|
39 |
-
with open(m, "rb") as f:
|
40 |
-
model = pickle.load(f)
|
41 |
-
|
42 |
|
43 |
|
44 |
|
@@ -80,7 +81,7 @@ for x in hist.index:
|
|
80 |
hist['Inflation'] = inflation
|
81 |
hist['CPI'] = cpi_col
|
82 |
|
83 |
-
|
84 |
|
85 |
hist['Quarter_end'] = np.where(hist.index.month%3==0,1,0)
|
86 |
|
@@ -111,7 +112,7 @@ hist['Quarter_end'] = np.where(hist.index.month%3==0,1,0)
|
|
111 |
# labels = np.array(labels)
|
112 |
# return dataset, labels
|
113 |
|
114 |
-
|
115 |
|
116 |
s = hf_hub_download(repo_id="marvmk/scalable_project", filename="scaler.save", repo_type='dataset')
|
117 |
scaler = joblib.load(s)
|
@@ -125,7 +126,7 @@ ds = []
|
|
125 |
ds.append(temp_df[0:10])
|
126 |
ds = np.array(ds)
|
127 |
|
128 |
-
|
129 |
|
130 |
predictions = model.predict(ds)
|
131 |
predictions
|
@@ -134,11 +135,11 @@ print(p)
|
|
134 |
a = np.array([0,0,0,p,0,0,0,0])
|
135 |
|
136 |
a = scaler.inverse_transform(a.reshape(1,-1))
|
137 |
-
|
138 |
|
139 |
final_prediction = a[-1][3]
|
140 |
|
141 |
-
|
142 |
|
143 |
import matplotlib.pyplot as plt
|
144 |
import streamlit as st
|
|
|
9 |
import numpy as np
|
10 |
import cpi
|
11 |
from sklearn.preprocessing import MinMaxScaler
|
12 |
+
from huggingface_hub import hf_hub_download
|
13 |
|
14 |
#cpi.update()
|
15 |
|
|
|
35 |
#m = hf_hub_download(repo_id="marvmk/model-test", filename="model.pkl")
|
36 |
#model = pickle.load(open(m, 'rb'))
|
37 |
|
38 |
+
|
39 |
+
#m=model_dir + "stock_model.pkl"
|
40 |
+
#with open(m, "rb") as f:
|
41 |
+
# model = pickle.load(f)
|
42 |
+
|
43 |
|
44 |
|
45 |
|
|
|
81 |
hist['Inflation'] = inflation
|
82 |
hist['CPI'] = cpi_col
|
83 |
|
84 |
+
|
85 |
|
86 |
hist['Quarter_end'] = np.where(hist.index.month%3==0,1,0)
|
87 |
|
|
|
112 |
# labels = np.array(labels)
|
113 |
# return dataset, labels
|
114 |
|
115 |
+
|
116 |
|
117 |
s = hf_hub_download(repo_id="marvmk/scalable_project", filename="scaler.save", repo_type='dataset')
|
118 |
scaler = joblib.load(s)
|
|
|
126 |
ds.append(temp_df[0:10])
|
127 |
ds = np.array(ds)
|
128 |
|
129 |
+
|
130 |
|
131 |
predictions = model.predict(ds)
|
132 |
predictions
|
|
|
135 |
a = np.array([0,0,0,p,0,0,0,0])
|
136 |
|
137 |
a = scaler.inverse_transform(a.reshape(1,-1))
|
138 |
+
|
139 |
|
140 |
final_prediction = a[-1][3]
|
141 |
|
142 |
+
|
143 |
|
144 |
import matplotlib.pyplot as plt
|
145 |
import streamlit as st
|