File size: 1,849 Bytes
3bbcdac
 
 
8979424
3bbcdac
 
c66a297
27157ce
 
 
 
 
 
 
 
 
 
 
11a6fe6
d131acb
4681a8e
9642920
413c677
 
 
 
 
 
 
 
 
 
 
 
f34f405
4681a8e
 
f34f405
4681a8e
 
6f26ba7
34cc919
413c677
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pandas as pd
from scipy.signal import savgol_filter
import joblib
import numpy as np
import plotly.express as px
import gradio as gr
#desc='Better use Without Last Node for now (same as SMA Principle). For one-time prediction only. EURUSD TF 1D for now.'
titik1=gr.Number(label='Node 1 (Close)')
titik2=gr.Number(label='Node 2 (Close)')
titik3=gr.Number(label='Node 3 (Close)')
titik4=gr.Number(label='Node 4 (Close)')
titik5=gr.Number(label='Node 5 (Close)')
titik6=gr.Number(label='Node 6 (Close)')
titik7=gr.Number(label='Node 7 (Close)')
titik8=gr.Number(label='Node 8 (Close)')
titik9=gr.Number(label='Node 9 (Close)')
titik10=gr.Number(label='Node 10 (Close)')
titik11=gr.Number(label='Node 11 (Close)')
pair=gr.Dropdown(["With Last Node","Without Last Node"])
net=joblib.load('model_savgolfilt')
def fn(pair,titik1,titik2,titik3,titik4,titik5,titik6,titik7,titik8,titik9,titik10,titik11):
    titik=np.array([])
    titik=np.append(titik,titik1)
    titik=np.append(titik,titik2)
    titik=np.append(titik,titik3)
    titik=np.append(titik,titik4)
    titik=np.append(titik,titik5)
    titik=np.append(titik,titik6)
    titik=np.append(titik,titik7)
    titik=np.append(titik,titik8)
    titik=np.append(titik,titik9)
    titik=np.append(titik,titik10)
    titik=np.append(titik,titik11)
    x=savgol_filter(titik,11,3)
    if pair=="With Last Node":
        hasil=net.predict([[x[len(x)-2],x[len(x)-1]]])
        keluar=px.line(y=[x[len(x)-2],x[len(x)-1],hasil[0]])
    elif pair=="Without Last Node":
        hasil=net.predict([[x[len(x)-3],x[len(x)-2]]])
        keluar=px.line(y=[x[len(x)-3],x[len(x)-2],hasil[0]])
    return keluar
app=gr.Interface(fn,inputs=[pair,titik1,titik2,titik3,titik4,titik5,titik6,titik7,titik8,titik9,titik10,titik11],outputs=[gr.Plot()],title='Savitsky-Golay Prediction') #description=desc
app.launch()