Zaktualizuj 'injectCode.py'

This commit is contained in:
Szymon Parafiński 2020-06-09 01:52:50 +00:00
parent 525ec6cde1
commit 9c3d698f05

View File

@ -3,14 +3,14 @@ import sys
def prediction(warzywo, nawoz ,srodek, stan_wzrostu): def prediction(warzywo, nawoz ,srodek, stan_wzrostu):
filename = 'pliki/decisionTree.sav' filename = 'decisionTree.sav'
tree = pickle.load(open(filename, 'rb')) tree = pickle.load(open(filename, 'rb'))
val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]])) val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]]))
save(val) save(val)
def save(prediction): def save(prediction):
pred = str(prediction) pred = str(prediction)
plik = open('pliki/dec.txt', 'w') plik = open('dec.txt', 'w')
plik.write(pred[1]) plik.write(pred[1])
plik.close() plik.close()