Update app.py
Browse files
app.py
CHANGED
|
@@ -19,21 +19,21 @@ with open('scaler.pkl', 'rb') as scaler_file:
|
|
| 19 |
def predict_7_days(sell_features, buy_features, linear_model, scaler):
|
| 20 |
# Data dari frontend
|
| 21 |
# Ambil nilai input (pastikan semuanya adalah angka)
|
| 22 |
-
sell_1 = float(sell_features[
|
| 23 |
-
sell_2 = float(sell_features[
|
| 24 |
-
sell_3 = float(sell_features[
|
| 25 |
-
sell_4 = float(sell_features[
|
| 26 |
-
sell_5 = float(sell_features[
|
| 27 |
-
sell_6 = float(sell_features[
|
| 28 |
-
sell_7 = float(sell_features[
|
| 29 |
-
|
| 30 |
-
buy_1 = float(buy_features[
|
| 31 |
-
buy_2 = float(buy_features[
|
| 32 |
-
buy_3 = float(buy_features[
|
| 33 |
-
buy_4 = float(buy_features[
|
| 34 |
-
buy_5 = float(buy_features[
|
| 35 |
-
buy_6 = float(buy_features[
|
| 36 |
-
buy_7 = float(buy_features[
|
| 37 |
|
| 38 |
# Menyusun data jual dan beli sebagai pasangan (sell, buy)
|
| 39 |
data = np.array([
|
|
@@ -80,7 +80,7 @@ def predict_7_days(sell_features, buy_features, linear_model, scaler):
|
|
| 80 |
|
| 81 |
|
| 82 |
# Harga terakhir
|
| 83 |
-
last_price = [sell_features[
|
| 84 |
|
| 85 |
# Hitung persentase perubahan harian
|
| 86 |
predictions_df['sell_change'] = predictions_df['sell'].pct_change().fillna(0) * 100
|
|
|
|
| 19 |
def predict_7_days(sell_features, buy_features, linear_model, scaler):
|
| 20 |
# Data dari frontend
|
| 21 |
# Ambil nilai input (pastikan semuanya adalah angka)
|
| 22 |
+
sell_1 = float(sell_features[6])
|
| 23 |
+
sell_2 = float(sell_features[5])
|
| 24 |
+
sell_3 = float(sell_features[4])
|
| 25 |
+
sell_4 = float(sell_features[3])
|
| 26 |
+
sell_5 = float(sell_features[2])
|
| 27 |
+
sell_6 = float(sell_features[1])
|
| 28 |
+
sell_7 = float(sell_features[0])
|
| 29 |
+
|
| 30 |
+
buy_1 = float(buy_features[6])
|
| 31 |
+
buy_2 = float(buy_features[5])
|
| 32 |
+
buy_3 = float(buy_features[4])
|
| 33 |
+
buy_4 = float(buy_features[3])
|
| 34 |
+
buy_5 = float(buy_features[2])
|
| 35 |
+
buy_6 = float(buy_features[1])
|
| 36 |
+
buy_7 = float(buy_features[0])
|
| 37 |
|
| 38 |
# Menyusun data jual dan beli sebagai pasangan (sell, buy)
|
| 39 |
data = np.array([
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
# Harga terakhir
|
| 83 |
+
last_price = [sell_features[7], buy_features[7]]
|
| 84 |
|
| 85 |
# Hitung persentase perubahan harian
|
| 86 |
predictions_df['sell_change'] = predictions_df['sell'].pct_change().fillna(0) * 100
|