Skip to content

Commit

Permalink
updated version
Browse files Browse the repository at this point in the history
  • Loading branch information
akibzaman committed Oct 20, 2021
1 parent b1f0201 commit 1e5466f
Show file tree
Hide file tree
Showing 32 changed files with 3,968 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn soil_nutrients.wsgi
web: waitress-serve --port=$PORT soil_nutrients.wsgi:application
1 change: 0 additions & 1 deletion README.md

This file was deleted.

Binary file added home/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added home/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added home/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added home/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added home/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/apps.cpython-39.pyc
Binary file not shown.
Binary file added home/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added home/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added home/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added home/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added home/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file added home/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file added home/__pycache__/views.cpython-39.pyc
Binary file not shown.
1,958 changes: 1,958 additions & 0 deletions home/dataset/Dataset_Update.csv

Large diffs are not rendered by default.

1,958 changes: 1,958 additions & 0 deletions home/dataset/data.csv

Large diffs are not rendered by default.

Binary file added home/trained_model/model_rf_B.pkl
Binary file not shown.
Binary file added home/trained_model/model_rf_Ca.pkl
Binary file not shown.
Binary file added home/trained_model/model_rf_K.pkl
Binary file not shown.
Binary file added home/trained_model/model_rf_Mg.pkl
Binary file not shown.
Binary file added home/trained_model/model_rf_Mn.pkl
Binary file not shown.
Binary file added home/trained_model/model_rf_Ph.pkl
Binary file not shown.
24 changes: 24 additions & 0 deletions home/trained_model/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pandas as pd
import pickle

train_feature=['B2Reft2','B3Reft3','B4Reft4','B5Reft5','B6Reft6','B7Reft7','Area','SoilType','LandClass']

base_path = "trained_model" #add your drive model folder path here
####Evaluation with Random Sample
model1= pickle.load(open(base_path+'/model_rf_Ph.pkl','rb'))
model2= pickle.load(open(base_path+'/model_rf_K.pkl','rb'))
model3= pickle.load(open(base_path+'/model_rf_B.pkl','rb'))
model4= pickle.load(open(base_path+'/model_rf_Ca.pkl','rb'))
model5= pickle.load(open(base_path+'/model_rf_Mg.pkl','rb'))
model6= pickle.load(open(base_path+'/model_rf_Mn.pkl','rb'))

test_case=[[0.14,0.14,0.14,0.14,0.14,0.14,0,2,2]]
test_case=pd.DataFrame(test_case, columns = train_feature )
# print(test_case)
Ph_pred = model1.predict(test_case)
K_pred = model2.predict(test_case)
B_pred = model3.predict(test_case)
Ca_pred = model4.predict(test_case)
Mg_pred = model5.predict(test_case)
Mn_pred = model6.predict(test_case)
print("{0}, {1}, {2}, {3}, {4}, {5} ".format(Ph_pred,K_pred,B_pred,Ca_pred,Mg_pred,Mn_pred))
9 changes: 6 additions & 3 deletions home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ def submitTestPage(request):


##=========================================================================


import pickle
def update_model(test_case):

Expand Down Expand Up @@ -277,7 +275,10 @@ def update_model_hybrid(test_case):
model4= pickle.load(open(base_path+'/Calcium-hybrid.pkl','rb'))
model5= pickle.load(open(base_path+'/Manesium-hybrid.pkl','rb'))
model6= pickle.load(open(base_path+'/Manganese-hybrid.pkl','rb'))


# test_case=[[0.14,0.14,0.14,0.14,0.14,0.14,0,2,2]]
# test_case=pd.DataFrame(test_case, columns = train_feature )
# print(test_case)
Ph_pred = model1.predict(test_case)
K_pred = model2.predict(test_case)
B_pred = model3.predict(test_case)
Expand All @@ -286,3 +287,5 @@ def update_model_hybrid(test_case):
Mn_pred = model6.predict(test_case)
return [Ph_pred[0],K_pred[0],B_pred[0],Ca_pred[0],Mg_pred[0],Mn_pred[0]]



28 changes: 15 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
absl-py==0.12.0
appdirs==1.4.4
asgiref==3.4.1
astroid==2.5.3
astunparse==1.6.3
cachetools==4.2.2
appdirs==1.4.4
asgiref==3.4.1
astroid==2.5.3
astunparse==1.6.3
cachetools==4.2.2
certifi==2021.5.30
chardet==4.0.0
click==8.0.1
colorama==0.4.4
chardet==4.0.0
click==8.0.1
colorama==0.4.4
cycler==0.10.0
distlib==0.3.2
Django==3.2.8
django-pandas==0.6.4
django-pandas==0.6.4
djangorestframework==3.12.4
filelock==3.0.12
Flask==2.0.1
flatbuffers==1.12
gast==0.4.0
google-auth==1.30.1
google-auth==1.30.1
google-auth-oauthlib==0.4.4
google-pasta==0.2.0
google-pasta==0.2.0
grpcio==1.34.1
gunicorn==20.1.0
h5py==3.1.0
idna==2.10
imbalanced-learn==0.8.1
imbalanced-learn==0.8.1
imblearn==0.0
install==1.3.4
isort==5.8.0
itsdangerous==2.0.1
itsdangerous==2.0.1
Jinja2==3.0.1
joblib==1.0.1
Keras==2.4.3
Expand Down Expand Up @@ -78,6 +78,8 @@ typing-extensions==3.7.4.3
urllib3==1.26.5
virtualenv==20.4.7
virtualenv-clone==0.5.4
waitress==2.0.0
Werkzeug==2.0.1
whitenoise==5.3.0
wrapt==1.12.1
xgboost==1.4.2
Binary file modified soil_nutrients/__pycache__/settings.cpython-39.pyc
Binary file not shown.
10 changes: 6 additions & 4 deletions soil_nutrients/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -20,12 +21,12 @@
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'l4+cknc5)o7yzjf8!xmocj3z9u0@0a9ux9kw_u-!b3%3llsl&g'

SECRET_KEY = os.environ['SECRET_KEY']
#'l4+cknc5)o7yzjf8!xmocj3z9u0@0a9ux9kw_u-!b3%3llsl&g'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["soil-nutrient-prediction.herokuapp.com","localhost"]


# Application definition
Expand All @@ -42,6 +43,7 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down Expand Up @@ -119,7 +121,7 @@
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = '/static/'

STATIC_ROOT= BASE_DIR / 'static'

import os
STATICFILES_DIRS = [
Expand Down

0 comments on commit 1e5466f

Please sign in to comment.