0

Hello guys im having a problem about inserting real-time data directly without using a csv file and dislay real-time accuracy of the data

Here's the Program :

import os
import time
from numpy import loadtxt
from keras.models import load_model



file = open("pima-indians-diabetes.csv", "a")
if os.stat("pima-indians-diabetes.csv").st_size == 2:
        file.write("Time,Engine RPM,Fuel Rail Pressure (direct inject),Accelerator pedal position D,Accelerator pedal position E,Air Flow Rate (MAF),Maximum value for mass air flow sensor,Control module voltage,Ambient air temperature,EGR Error,Commanded EGR\n")

model = load_model('model.h5')
dataset = loadtxt("pima-indians-diabetes.csv", delimiter=",")

X = dataset[:,0:8]
Y = dataset[:,8]

score = model.evaluate(X, Y, verbose=0)


count = 0
response1 = 0
response2 = 0
response3 = 0
response4 = 0
response5 = 0
response6 = 0
response7 = 0
response8 = 0
response9 = 0

while True:
    count = count + 1
    response1 = response1 + 1
    response2 = response2 + 1
    response3 = response3 + 1
    response4 = response4 + 1
    response5 = response5 + 1
    response6 = response6 + 1
    response7 = response7 + 1
    response8 = response8 + 1
    response9 = response9 + 1

    file.write(str(response1)+","+str(response2)+","+str(response3)+","+str(response4)+","+str(response5)+","+str(response6)+","+str(response7)+","+str(response8)+","+str(response9)+"\n")
    file.flush()


    print("%s: %.2f%%" % (model.metrics_names[1], score[1]*100))
    time.sleep(1)

here it just display the accuracy once and loop and it did not read again the csv file

  • insert real-time data into what? – jsotola Feb 2 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.