diff --git a/injectCode.py b/injectCode.py index 87828bc..3e7b70b 100644 --- a/injectCode.py +++ b/injectCode.py @@ -1,33 +1,33 @@ -import pickle -import sys - - -def prediction(warzywo, nawoz ,srodek, stan_wzrostu): - filename = 'pliki/decisionTree.sav' - tree = pickle.load(open(filename, 'rb')) - val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]])) - save(val) - -def save(prediction): - pred = str(prediction) - plik = open('pliki/dec.txt', 'w') - plik.write(pred[1]) - plik.close() - -def decision(prediction): - if prediction == 0: - return "Nie_podejmuj_dzialania" - elif prediction == 1: - return "Zastosuj_nawoz" - elif prediction == 2: - return "Zastosuj_srodek" - elif prediction == 4: - return "Zbierz" - elif prediction == 5: - return "Roslina_juz_zgnila__zbierz_i_wyrzuc" - - - -if __name__ == '__main__': - # Map command line arguments to function arguments. +import pickle +import sys + + +def prediction(warzywo, nawoz ,srodek, stan_wzrostu): + filename = 'decisionTree.sav' + tree = pickle.load(open(filename, 'rb')) + val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]])) + save(val) + +def save(prediction): + pred = str(prediction) + plik = open('dec.txt', 'w') + plik.write(pred[1]) + plik.close() + +def decision(prediction): + if prediction == 0: + return "Nie_podejmuj_dzialania" + elif prediction == 1: + return "Zastosuj_nawoz" + elif prediction == 2: + return "Zastosuj_srodek" + elif prediction == 4: + return "Zbierz" + elif prediction == 5: + return "Roslina_juz_zgnila__zbierz_i_wyrzuc" + + + +if __name__ == '__main__': + # Map command line arguments to function arguments. prediction(*sys.argv[1:]) \ No newline at end of file