-
Notifications
You must be signed in to change notification settings - Fork 1
/
flows.py
33 lines (25 loc) · 869 Bytes
/
flows.py
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
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = tf.keras.models.load_model('model/flows.h5')
usbModel = tf.keras.models.load_model('model/usb_flows.h5')
shdrModel = tf.keras.models.load_model('model/shdr_flows.h5')
def predictFlows(data):
df = pd.json_normalize(data)
dataset = df
dataset['memberDay'] = dataset['memberDay']*10000
# dataset['isWeekend'] = dataset['isWeekend']*1.0
# dataset['day'] = dataset['day']*1.0
predictions = model.predict(dataset).flatten()
return predictions
def predictUsbFlows(data):
df = pd.json_normalize(data)
dataset = df
predictions = usbModel.predict(dataset).flatten()
return predictions
def predictShdrFlows(data):
df = pd.json_normalize(data)
dataset = df
predictions = shdrModel.predict(dataset).flatten()
return predictions