-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
76 lines (63 loc) · 1.96 KB
/
test.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from wsgiref import simple_server
from flask import Flask, request
from flask import Response
import os
import pandas as pd
from flask_cors import CORS, cross_origin
from prediction_Validation_Insertion import pred_validation
from trainingModel import trainModel
from training_Validation_Insertion import train_validation
import flask_monitoringdashboard as dashboard
from predictFromModel import prediction
os.putenv('LANG', 'en_US.UTF-8')
os.putenv('LC_ALL', 'en_US.UTF-8')
#
try:
path = 'Prediction_Batch_Files'
#pred_val = pred_validation(path) #object initialization
#
#pred_val.prediction_validation() #calling the prediction_validation function
pred = prediction(path) #object initialization
# predicting for dataset present in database
path = pred.predictionFromModel()
print("Prediction File created at %s!!!" % path)
#
except ValueError:
print("Error Occurred! %s" %ValueError)
except KeyError:
print("Error Occurred! %s" %KeyError)
except Exception as e:
print("Error Occurred! %s" %e)
# try:
#
# path = 'Training_Batch_Files'
# train_valObj = train_validation(path) #object initialization
# train_valObj.train_validation()
# print("validation successfull!!")
# #train_valObj.train_validation()#calling the training_validation function
#
#
# trainModelObj = trainModel() #object initialization
# trainModelObj.trainingModel() #training the model for the files in the table
#
#
# except ValueError:
#
# print("Error Occurred! %s" % ValueError)
#
# except KeyError:
#
# print("Error Occurred! %s" % KeyError)
#
# except Exception as e:
#
# print("Error Occurred! %s" % e)
# print("Training successfull!!")
# path = 'Prediction_Batch_Files'
# newpath = 'Prediction_Batch_Files/new'
#
# onlyfiles = [f for f in os.listdir(path)]
# for file in onlyfiles:
# data = pd.read_csv(path + "/" + file)
# data= data.drop(['Income'],axis=1)
# data.to_csv(newpath + "/" + file, index=None, header=True)