move tensorflow as a lazyload and wrap in main
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import tensorflow as tf
|
||||
import keras
|
||||
import sqlite3
|
||||
from datetime import date, datetime
|
||||
from datapuller import DataPuller
|
||||
|
||||
def main():
|
||||
# Initilize SqLite
|
||||
dbconn = sqlite3.connect("./data/appdata.db")
|
||||
dbcursor = dbconn.cursor()
|
||||
@@ -35,11 +35,13 @@ else:
|
||||
# If the strings dont match becuase were only checking day it has to be a new day so update the data
|
||||
if lastrun != str(date.today()):
|
||||
# This will update the data store in the data folder
|
||||
import datapuller
|
||||
DataPuller.pull()
|
||||
# Update the last run to today
|
||||
SetKey("LastRun", str(date.today()))
|
||||
|
||||
# Load in the AI algorithm
|
||||
# Load in the AI algorithm late so yfinance works properly
|
||||
import tensorflow as tf
|
||||
import keras
|
||||
from keras.layers import Dense, Flatten, Conv2D
|
||||
from keras import Model
|
||||
|
||||
@@ -57,3 +59,6 @@ train_ds = tf.data.Dataset.from_tensor_slices(
|
||||
(x_train, y_train)).shuffle(10000).batch(32)
|
||||
|
||||
test_ds = tf.data.Dataset.from_tensor_slices((x_test, y_test)).batch(32)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user