TuanScientist commited on
Commit
df112e3
0 Parent(s):

Duplicate from TuanScientist/BTCforecasting

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
Bitcoin Historical Data - Investing.com.csv ADDED
The diff for this file is too large to render. See raw diff
 
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: BTCforecasting
3
+ emoji: 🦀
4
+ colorFrom: red
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 3.35.2
8
+ app_file: app.py
9
+ pinned: false
10
+ license: openrail
11
+ duplicated_from: TuanScientist/BTCforecasting
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from neuralprophet import NeuralProphet, set_log_level
4
+ import warnings
5
+
6
+ set_log_level("ERROR")
7
+ warnings.filterwarnings("ignore", category=UserWarning)
8
+
9
+ url = "Bitcoin Historical Data - Investing.com.csv"
10
+ df = pd.read_csv(url)
11
+ df = df[["Date", "Price"]]
12
+ df = df.rename(columns={"Date": "ds", "Price": "y"})
13
+ df.fillna(method='ffill', inplace=True)
14
+ df.dropna(inplace=True)
15
+
16
+ m = NeuralProphet(n_forecasts=3,
17
+ n_lags=36,
18
+ changepoints_range=1, num_hidden_layers=6, daily_seasonality= False, weekly_seasonality = False, yearly_seasonality = True, ar_reg=True,
19
+ n_changepoints=100, trend_reg_threshold=True, d_hidden=9, global_normalization=True, global_time_normalization=True, seasonality_reg=1, unknown_data_normalization=True,
20
+ seasonality_mode="multiplicative", drop_missing=True,
21
+ learning_rate=0.0314
22
+ )
23
+
24
+ m.fit(df, freq='M')
25
+
26
+ future = m.make_future_dataframe(df, periods=3, n_historic_predictions=True)
27
+ forecast = m.predict(future)
28
+
29
+ def predict_vn_index(option=None):
30
+ fig1 = m.plot(forecast)
31
+ fig1_path = "forecast_plot1.png"
32
+ fig1.savefig(fig1_path)
33
+
34
+ # Add code to generate the second image (fig2)
35
+ fig2 = m.plot_latest_forecast(forecast) # Replace this line with code to generate the second image
36
+ fig2_path = "forecast_plot2.png"
37
+ fig2.savefig(fig2_path)
38
+ description = "Dự đoán được thực hiện bởi thuật toán AI học sâu (Deep Learning), và học tăng cường dữ liệu bởi đội ngũ AI Consultant. Dữ liệu được cập nhật mới sau 17h của ngày giao dịch."
39
+ disclaimer = "Quý khách chỉ xem đây là tham khảo, công ty không chịu bất cứ trách nhiệm nào về tình trạng đầu tư của quý khách."
40
+
41
+
42
+ return fig1_path, fig2_path, description, disclaimer
43
+
44
+
45
+ if __name__ == "__main__":
46
+ dropdown = gr.inputs.Dropdown(["BTC"], label="Choose an option", default="BTC")
47
+ outputs = [
48
+ gr.outputs.Image(type="filepath", label="Lịch sử BTC và dự đoán"),
49
+ gr.outputs.Image(type="filepath", label="Dự đoán BTC cho 90 ngày tới"),
50
+ gr.outputs.Textbox(label="Mô tả"),
51
+ gr.outputs.Textbox(label="Disclaimer")
52
+ ]
53
+ interface = gr.Interface(fn=predict_vn_index, inputs=dropdown, outputs=outputs, title="Dự báo BTC 90 ngày tới")
54
+ interface.launch()
55
+
lightning_logs/hello.txt ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio==3.32.0
2
+ pandas==1.5.3
3
+ neuralprophet==0.5.1
4
+ matplotlib==3.7.1
5
+ holidays==0.11.3.1
6
+ torch==1.13.1
7
+ pytorch-lightning==1.7.4