import sys sys.path.append("/home/app/code/") from pyspark.sql import SparkSession from pyspark.sql import SQLContext from extract import Extract from transform import Transformer from load import Load if __name__ == '__main__': spark = SparkSession \ .builder \ .appName("Covid App") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() sqlContext = SQLContext(spark) df = Extract(spark) df = df.extract_covid_data() transformer = Transformer(df, sqlContext) transformer.data_types_transformations() transformed_df = transformer.dimensions_transfomations() transformed_df = transformer.fill_na(transformed_df) loader = Load(transformed_df) loader.load_data()
ap.add_argument("-t", "--train-model", type=int, default=-1, help="(Optional) Whether to train a previous model.") ap.add_argument("-w", "--weights", type=str, help="(Optional) Path of weights file") args = vars(ap.parse_args()) gWeightsPath = "output/" + args["weights"] + ".gener" + ".hdf5" dWeightsPath = "output/" + args["weights"] + ".discrim" + ".hdf5" # Load data _X = Load.load_data() # Convert to np arrays X = np.array(_X) # Scale data to [-1, 1] range X = (X.astype("float32") - 127.5) / 127.5 # Initialize optimizer and model print("Loading model...") loadPath = args["load_model"] > 0 or args["train_model"] > 0 opt = SGD(lr=0.001, momentum=0.5, nesterov=True) modelG = Models.buildGenerator(vectSize=100, weightsPath=gWeightsPath if loadPath else None) modelD = Models.buildDiscriminator( numChannels=3,
def back_menu(self): """ I display the back-office menu. """ self.clear() self.views.header_admin() option = self.views.admin_choice() if option == "0": self.main_menu() elif option == "1": self.clear() self.views.header_admin() self.db.db_create() self.views.pause() self.back_menu() elif option == "2": self.clear() self.views.header_admin() self.db.tables_create() self.views.pause() self.back_menu() elif option == "3": self.clear() self.views.header_admin() self.db.tables_delete() self.views.pause() self.back_menu() elif option == "4": self.clear() self.views.header_admin() extraction = Extract() extraction.extract() self.views.pause() self.back_menu() elif option == "5": self.clear() self.views.header_admin() transform = Transform() transform.transform_basic() self.views.pause() self.back_menu() elif option == "6": self.clear() self.views.header_admin() load = Load() load.load_data() self.views.pause() self.back_menu() elif option == "7": self.clear() self.views.header_admin() extraction = Extract() transform = Transform() load = Load() extraction.extract() transform.transform_basic() load.load_data() self.views.pause() self.back_menu() elif option == "Q" or option == "q": sys.exit else: print(""" Vous devez taper A ou Q Merci de réessayer.""") time.sleep(2) self.back_menu()