Spaces:
Runtime error
Runtime error
add models
Browse files- data/models/cereals_knn.pkl +3 -0
- data/models/fresh_veg_et.pkl +3 -0
- data/models/fruits&nuts_knn.pkl +3 -0
- data/models/grapes_olives_et.pkl +3 -0
- data/models/industrial_crop_et.pkl +3 -0
- logs.log +10 -0
- pages/demo.py +339 -10
- requirements.txt +2 -1
data/models/cereals_knn.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b4ce13b778031582a72b95d8ffc783e2754d08c639a73458a56f13db5a9bb0cf
|
3 |
+
size 14461645
|
data/models/fresh_veg_et.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3c91439300ee6cc546fc25e588aa18d1fb0a23eeb60638fec4e7526cca539db6
|
3 |
+
size 103676865
|
data/models/fruits&nuts_knn.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3ed6569eb296b5bd782a6dfc9c57d1be699c5e1e5427dbf341b67d2594c35c3e
|
3 |
+
size 14346669
|
data/models/grapes_olives_et.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:816dfc0a50255dfaaa757b266b096ef0b640903e48fcc068ce91820252557d54
|
3 |
+
size 15175359
|
data/models/industrial_crop_et.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6884fafeedaebfa2d3296fcccdb069aeb11e6c7cc2d79a6d270b8c2ba5346e97
|
3 |
+
size 32917055
|
logs.log
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2022-11-08 15:59:38,643:WARNING:
|
2 |
+
'cuml' is a soft dependency and not included in the pycaret installation. Please run: `pip install cuml` to install.
|
3 |
+
2022-11-08 15:59:38,643:WARNING:
|
4 |
+
'cuml' is a soft dependency and not included in the pycaret installation. Please run: `pip install cuml` to install.
|
5 |
+
2022-11-08 15:59:38,643:WARNING:
|
6 |
+
'cuml' is a soft dependency and not included in the pycaret installation. Please run: `pip install cuml` to install.
|
7 |
+
2022-11-08 15:59:38,644:WARNING:
|
8 |
+
'cuml' is a soft dependency and not included in the pycaret installation. Please run: `pip install cuml` to install.
|
9 |
+
2022-11-08 15:59:39,757:WARNING:
|
10 |
+
'prophet' is a soft dependency and not included in the pycaret installation. Please run: `pip install prophet` to install.
|
pages/demo.py
CHANGED
@@ -1,15 +1,344 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
-
import
|
4 |
-
|
5 |
-
import folium
|
6 |
from PIL import Image
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from pycaret.regression import load_model, predict_model
|
3 |
import streamlit as st
|
4 |
import pandas as pd
|
5 |
+
import numpy as np
|
6 |
+
|
|
|
7 |
from PIL import Image
|
8 |
+
#image = Image.open('omdena_logo.png')
|
9 |
+
#st.set_page_config(page_title='omdena-milan', page_icon=image)
|
10 |
+
import pycaret
|
11 |
+
|
12 |
+
|
13 |
+
model1 = load_model('data/models/cereals_knn')
|
14 |
+
model2= load_model('data/models/fruits&nuts_knn')
|
15 |
+
model3 = load_model('data/models/grapes_olives_et')
|
16 |
+
model4 = load_model('data/models/fresh_veg_et')
|
17 |
+
model5 = load_model('data/models/industrial_crop_et')
|
18 |
+
|
19 |
+
|
20 |
+
def predict1(model1, input_df1):
|
21 |
+
predictions_df1 = predict_model(estimator=model1, data=input_df1)
|
22 |
+
predictions1 = predictions_df1['prediction_label'][0]
|
23 |
+
return predictions1
|
24 |
+
|
25 |
+
def predict2(model2, input_df2):
|
26 |
+
predictions_df2= predict_model(estimator=model2, data=input_df2)
|
27 |
+
predictions2 = predictions_df2['prediction_label'][0]
|
28 |
+
return predictions2
|
29 |
+
|
30 |
+
def predict3(model3, input_df3):
|
31 |
+
predictions_df3 = predict_model(estimator=model3, data=input_df3)
|
32 |
+
predictions3 = predictions_df3['prediction_label'][0]
|
33 |
+
return predictions3
|
34 |
+
|
35 |
+
def predict4(model4, input_df4):
|
36 |
+
predictions_df4= predict_model(estimator=model4, data=input_df4)
|
37 |
+
predictions4 = predictions_df4['prediction_label'][0]
|
38 |
+
return predictions4
|
39 |
+
|
40 |
+
def predict5(model5, input_df5):
|
41 |
+
predictions_df5= predict_model(estimator=model5, data=input_df5)
|
42 |
+
predictions5 = predictions_df5['prediction_label'][0]
|
43 |
+
return predictions5
|
44 |
+
|
45 |
+
|
46 |
+
def run():
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
add_selectbox = st.sidebar.selectbox(
|
51 |
+
"Please choose your crop",
|
52 |
+
("Cereal & Legumes", "Fruits & Nuts", "Grapes & Olives", "Fresh Vegetables","Industrial crops", ))
|
53 |
+
|
54 |
+
st.sidebar.info('Omdena-Milan Agrifood')
|
55 |
+
st.sidebar.success('https://omdena.com/local-chapters/milan-italy-chapter/')
|
56 |
+
|
57 |
+
st.title("Crop Prediction")
|
58 |
+
|
59 |
+
if add_selectbox == 'Cereal & Legumes':
|
60 |
+
|
61 |
+
temperature_max = st.number_input('Temperature max (°C)', min_value= 20, max_value= 50)
|
62 |
+
|
63 |
+
temperature_min = st.number_input('Temperature min (°C)', min_value= -5, max_value= 20)
|
64 |
+
|
65 |
+
relative_humidity = st.number_input('Relative humidity (%)', min_value=0, max_value=100)
|
66 |
+
|
67 |
+
root_moisture = st.number_input('Root moisture', max_value=1)
|
68 |
+
|
69 |
+
total_area_ha = st.number_input('Total area(ha)', min_value=0, max_value=6150)
|
70 |
+
|
71 |
+
fertilizer_tonnes = st.number_input('Fertilizer (tonnes)', min_value=0, max_value=3405)
|
72 |
+
|
73 |
+
fertilizer = st.selectbox('Type of fertilizer', ['calcium cyanamide', 'nitrogen-potassium', 'peaty-amend',
|
74 |
+
'organic-nitrogen', 'organic', 'ammonium sulphate',
|
75 |
+
'nitrogen-phosphorous', 'phosphorus-potassium', 'urea'])
|
76 |
+
|
77 |
+
crop = st.selectbox('Type of crop', ['barley', 'bro-bean', 'chick-peas', 'dry-k-bean', 'd-wheat',
|
78 |
+
'early potatoes', 'lentil', 'oats', 'potatoes', 'grain pea',
|
79 |
+
'oats mix', 'spring barley', 'winter barley', 'c-wheat', 'maize',
|
80 |
+
'protein pea', 'rice', 'sorghum', 'sugar beet', 'other cereals',
|
81 |
+
'rye', 'titicale', 'c-spr-wheat&spelt', 'c-wint-wheat&spelt',
|
82 |
+
'sweet potatoes', 'sweet lupin', 'rye mix', 'cereal mix',
|
83 |
+
'wint-cereal-mix'])
|
84 |
+
|
85 |
+
city = st.selectbox('City', ['Agrigento', 'Alessandria', 'Ancona', 'Arezzo', 'Ascoli Piceno',
|
86 |
+
'Asti', 'Avellino', 'Bari', 'Barletta-Andria-Trani', 'Belluno',
|
87 |
+
'Benevento', 'Bergamo', 'Biella', 'Bologna', 'Bolzano / Bozen',
|
88 |
+
'Brescia', 'Brindisi', 'Cagliari', 'Caltanissetta', 'Campobasso',
|
89 |
+
'Carbonia-Iglesias', 'Caserta', 'Catania', 'Catanzaro', 'Chieti',
|
90 |
+
'Como', 'Cosenza', 'Cremona', 'Crotone', 'Cuneo', 'Enna', 'Fermo',
|
91 |
+
'Ferrara', 'Firenze', 'Foggia', 'Forlì-Cesena', 'Frosinone',
|
92 |
+
'Genova', 'Gorizia', 'Grosseto', 'Imperia', 'Isernia', "L'Aquila",
|
93 |
+
'La Spezia', 'Latina', 'Lecce', 'Lecco', 'Livorno', 'Lodi',
|
94 |
+
'Lucca', 'Macerata', 'Mantova', 'Massa-Carrara', 'Matera',
|
95 |
+
'Medio Campidano', 'Messina', 'Milano', 'Modena',
|
96 |
+
'Monza e della Brianza', 'Napoli', 'Novara', 'Nuoro', 'Ogliastra',
|
97 |
+
'Olbia-Tempio', 'Oristano', 'Padova', 'Palermo', 'Parma', 'Pavia',
|
98 |
+
'Perugia', 'Pesaro e Urbino', 'Pescara', 'Piacenza', 'Pisa',
|
99 |
+
'Pistoia', 'Pordenone', 'Potenza', 'Prato', 'Ragusa', 'Ravenna',
|
100 |
+
'Reggio di Calabria', "Reggio nell'Emilia", 'Rieti', 'Rimini',
|
101 |
+
'Roma', 'Rovigo', 'Salerno', 'Sassari', 'Savona', 'Siena',
|
102 |
+
'Siracusa', 'Sondrio', 'Sud Sardegna', 'Taranto', 'Teramo',
|
103 |
+
'Terni', 'Torino', 'Trapani', 'Trentino Alto Adige / Südtirol',
|
104 |
+
'Trento', 'Treviso', 'Trieste', 'Udine',"Valle d'Aosta / Vallée d'Aoste",
|
105 |
+
'Varese', 'Venezia', 'Verbano-Cusio-Ossola', 'Vercelli',
|
106 |
+
'Verona', 'Vibo Valentia', 'Vicenza', 'Viterbo'])
|
107 |
+
output1=""
|
108 |
+
|
109 |
+
input_dict1 = {'T2M_MAX': temperature_max, 'T2M_MIN':temperature_min,'RH2M' : relative_humidity, 'total_area_ha': total_area_ha,
|
110 |
+
'GWETROOT' : root_moisture, 'Type_crop' : crop, 'Type_fertilizer': fertilizer, 'Fertilizers_tonnes': fertilizer_tonnes ,'City' : city}
|
111 |
+
input_df1 = pd.DataFrame([input_dict1])
|
112 |
+
|
113 |
+
if st.button("Predict Cereal & Legumes"):
|
114 |
+
output1 = predict1(model1=model1, input_df1=input_df1)
|
115 |
+
output1 = 'Tons ' + "{:.2f}".format(output1)
|
116 |
+
|
117 |
+
st.success('The output is {}'.format(output1))
|
118 |
+
|
119 |
+
if add_selectbox == 'Fruits & Nuts':
|
120 |
+
|
121 |
+
temperature_max = st.number_input('Temperature max (°C)', min_value= 20, max_value= 50)
|
122 |
+
|
123 |
+
temperature_min = st.number_input('Temperature min (°C)', min_value= -5, max_value= 20)
|
124 |
+
|
125 |
+
relative_humidity = st.number_input('Relative humidity (%)', min_value=0, max_value=100)
|
126 |
+
|
127 |
+
root_moisture = st.number_input('Root moisture', max_value=1)
|
128 |
+
|
129 |
+
total_area_ha = st.number_input('Total area(ha)', min_value=0, max_value=430)
|
130 |
+
|
131 |
+
fertilizer_tonnes = st.number_input('Fertilizer (tonnes)', min_value=0, max_value=3477)
|
132 |
+
|
133 |
+
fertilizer = st.selectbox('Type of fertilizer', ['calcium cyanamide', 'nitrogen-potassium', 'peaty-amend',
|
134 |
+
'organic-nitrogen', 'organic', 'ammonium sulphate',
|
135 |
+
'nitrogen-phosphorous', 'phosphorus-potassium', 'urea'])
|
136 |
+
|
137 |
+
crop = st.selectbox('Type of crop', ['apple', 'apricot', 'cherry in complex', 'kiwi', 'nectarine',
|
138 |
+
'plum', 'hazelnut', 'pear', 'peach', 'almond'])
|
139 |
+
|
140 |
+
city = st.selectbox('City', ['Agrigento', 'Alessandria', 'Ancona', 'Arezzo', 'Ascoli Piceno',
|
141 |
+
'Asti', 'Avellino', 'Bari', 'Belluno', 'Benevento', 'Bergamo',
|
142 |
+
'Biella', 'Bologna', 'Brescia', 'Brindisi', 'Caltanissetta',
|
143 |
+
'Campobasso', 'Caserta', 'Catania', 'Catanzaro', 'Chieti', 'Como',
|
144 |
+
'Cosenza', 'Cremona', 'Crotone', 'Enna', 'Ferrara', 'Firenze',
|
145 |
+
'Foggia', 'Frosinone', 'Genova', 'Gorizia', 'Grosseto', 'Imperia',
|
146 |
+
'Isernia', 'La Spezia', 'Latina', 'Lecce', 'Lecco', 'Livorno',
|
147 |
+
'Lodi', 'Lucca', 'Macerata', 'Mantova', 'Matera', 'Messina',
|
148 |
+
'Milano', 'Modena', 'Napoli', 'Novara', 'Nuoro', 'Oristano',
|
149 |
+
'Padova', 'Palermo', 'Parma', 'Pavia', 'Perugia',
|
150 |
+
'Pesaro e Urbino', 'Pescara', 'Piacenza', 'Pisa', 'Pistoia',
|
151 |
+
'Pordenone', 'Potenza', 'Prato', 'Ragusa', 'Ravenna',
|
152 |
+
'Reggio di Calabria', "Reggio nell'Emilia", 'Rieti', 'Rimini',
|
153 |
+
'Roma', 'Rovigo', 'Salerno', 'Sassari', 'Savona', 'Siena',
|
154 |
+
'Siracusa', 'Taranto', 'Teramo', 'Terni', 'Torino', 'Trapani',
|
155 |
+
'Treviso', 'Trieste', 'Udine', 'Varese', 'Venezia',
|
156 |
+
'Verbano-Cusio-Ossola', 'Vercelli', 'Verona', 'Vibo Valentia',
|
157 |
+
'Vicenza', 'Viterbo', 'Carbonia-Iglesias', 'Medio Campidano',
|
158 |
+
'Ogliastra', 'Olbia-Tempio', 'Barletta-Andria-Trani', 'Fermo',
|
159 |
+
'Monza e della Brianza'])
|
160 |
+
|
161 |
+
|
162 |
+
output2=""
|
163 |
+
|
164 |
+
input_dict2 = {'T2M_MAX': temperature_max, 'T2M_MIN':temperature_min,'RH2M' : relative_humidity, 'total_area_ha': total_area_ha,
|
165 |
+
'GWETROOT' : root_moisture, 'Type_crop' : crop, 'Type_fertilizer': fertilizer, 'Fertilizers_tonnes': fertilizer_tonnes ,'City' : city}
|
166 |
+
input_df2 = pd.DataFrame([input_dict2])
|
167 |
+
|
168 |
+
if st.button("Predict Fruits & Nuts"):
|
169 |
+
output2 = predict2(model2=model2, input_df2=input_df2)
|
170 |
+
output2 = 'Tons ' + "{:.2f}".format(output2)
|
171 |
+
|
172 |
+
st.success('The output is {}'.format(output2))
|
173 |
+
|
174 |
+
|
175 |
+
if add_selectbox == 'Grapes & Olives':
|
176 |
+
|
177 |
+
temperature_max = st.number_input('Temperature max (°C)', min_value= 20, max_value= 50)
|
178 |
+
|
179 |
+
temperature_min = st.number_input('Temperature min (°C)', min_value= -5, max_value= 20)
|
180 |
+
|
181 |
+
relative_humidity = st.number_input('Relative humidity (%)', min_value=0, max_value=100)
|
182 |
+
|
183 |
+
root_moisture = st.number_input('Root moisture', max_value=1)
|
184 |
+
|
185 |
+
total_area_ha = st.number_input('Total area(ha)', min_value=0, max_value=5010)
|
186 |
+
|
187 |
+
fertilizer_tonnes = st.number_input('Fertilizer (tonnes)', min_value=0, max_value=2852)
|
188 |
+
|
189 |
+
fertilizer = st.selectbox('Type of fertilizer', ['calcium cyanamide', 'nitrogen-potassium', 'peaty-amend',
|
190 |
+
'organic-nitrogen', 'organic', 'ammonium sulphate',
|
191 |
+
'nitrogen-phosphorous', 'phosphorus-potassium', 'urea'])
|
192 |
+
|
193 |
+
crop = st.selectbox('Type of crop', ['grapes-n.e.c', 'grapes-wines(N-pdo/pgi)', 'table olives',
|
194 |
+
'grapes-table', 'oil olives', 'other olives',
|
195 |
+
'grapes-wines(Y-pdo)', 'grapes-wines(Y-pgi)', 'grapes-raisins'])
|
196 |
+
|
197 |
+
city = st.selectbox('City', ['Agrigento', 'Alessandria', 'Ancona', 'Arezzo', 'Ascoli Piceno',
|
198 |
+
'Asti', 'Avellino', 'Bari', 'Belluno', 'Benevento', 'Bergamo',
|
199 |
+
'Biella', 'Bologna', 'Brescia', 'Brindisi', 'Caltanissetta',
|
200 |
+
'Campobasso', 'Caserta', 'Catania', 'Catanzaro', 'Chieti',
|
201 |
+
'Cosenza', 'Cremona', 'Crotone', 'Enna', 'Ferrara', 'Firenze',
|
202 |
+
'Foggia', 'Frosinone', 'Genova', 'Grosseto', 'Imperia', 'Isernia',
|
203 |
+
'La Spezia', 'Latina', 'Lecce', 'Livorno', 'Lodi', 'Lucca',
|
204 |
+
'Macerata', 'Mantova', 'Matera', 'Messina', 'Milano', 'Modena',
|
205 |
+
'Napoli', 'Novara', 'Nuoro', 'Oristano', 'Padova', 'Palermo',
|
206 |
+
'Parma', 'Pavia', 'Perugia', 'Pesaro e Urbino', 'Pescara',
|
207 |
+
'Piacenza', 'Pisa', 'Pistoia', 'Pordenone', 'Potenza', 'Prato',
|
208 |
+
'Ragusa', 'Ravenna', 'Reggio di Calabria', "Reggio nell'Emilia",
|
209 |
+
'Rieti', 'Rimini', 'Roma', 'Rovigo', 'Salerno', 'Sassari',
|
210 |
+
'Savona', 'Siena', 'Siracusa', 'Taranto', 'Teramo', 'Terni',
|
211 |
+
'Torino', 'Trapani', 'Treviso', 'Trieste', 'Udine', 'Varese',
|
212 |
+
'Venezia', 'Verbano-Cusio-Ossola', 'Vercelli', 'Verona',
|
213 |
+
'Vibo Valentia', 'Vicenza', 'Viterbo', 'Carbonia-Iglesias',
|
214 |
+
'Medio Campidano', 'Ogliastra', 'Olbia-Tempio',
|
215 |
+
'Barletta-Andria-Trani', 'Fermo', 'Monza e della Brianza'])
|
216 |
+
|
217 |
+
|
218 |
+
output3=""
|
219 |
+
|
220 |
+
input_dict3 = {'T2M_MAX': temperature_max, 'T2M_MIN':temperature_min,'RH2M' : relative_humidity, 'total_area_ha': total_area_ha,
|
221 |
+
'GWETROOT' : root_moisture, 'Type_crop' : crop, 'Type_fertilizer': fertilizer, 'Fertilizers_tonnes': fertilizer_tonnes ,'City' : city}
|
222 |
+
input_df3 = pd.DataFrame([input_dict3])
|
223 |
+
|
224 |
+
if st.button("Predict Grapes & Olives"):
|
225 |
+
output3 = predict3(model3=model3, input_df3=input_df3)
|
226 |
+
output3 = 'Tons ' + "{:.2f}".format(output3)
|
227 |
+
|
228 |
+
st.success('The output is {}'.format(output3))
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
if add_selectbox == 'Fresh Vegetables':
|
233 |
+
|
234 |
+
temperature_max = st.number_input('Temperature max (°C)', min_value= 20, max_value= 50)
|
235 |
+
|
236 |
+
temperature_min = st.number_input('Temperature min (°C)', min_value= -5, max_value= 20)
|
237 |
+
|
238 |
+
relative_humidity = st.number_input('Relative humidity (%)', min_value=0, max_value=100)
|
239 |
+
|
240 |
+
root_moisture = st.number_input('Root moisture', max_value=1)
|
241 |
+
|
242 |
+
total_area_ha = st.number_input('Total area(ha)', min_value=0, max_value=431)
|
243 |
+
|
244 |
+
fertilizer_tonnes = st.number_input('Fertilizer (tonnes)', min_value=0, max_value=3473)
|
245 |
+
|
246 |
+
fertilizer = st.selectbox('Type of fertilizer', ['calcium cyanamide', 'nitrogen-potassium', 'peaty-amend',
|
247 |
+
'organic-nitrogen', 'organic', 'ammonium sulphate',
|
248 |
+
'nitrogen-phosphorous', 'phosphorus-potassium', 'urea'])
|
249 |
+
|
250 |
+
crop = st.selectbox('Type of crop', ['cauliflower&broccoli-field', 'courgette-field', 'egg-plant-field',
|
251 |
+
'fresh-beans-field', 'lettuce-field', 'onions-field',
|
252 |
+
'red-pepper-field', 'chicory-field', 'melon-field', 'fresh-tomato'])
|
253 |
+
|
254 |
+
city = st.selectbox('City', ['Agrigento', 'Alessandria', 'Ancona', 'Arezzo', 'Ascoli Piceno',
|
255 |
+
'Asti', 'Avellino', 'Bari', 'Belluno', 'Benevento', 'Bergamo',
|
256 |
+
'Biella', 'Bologna', 'Brescia', 'Brindisi', 'Caltanissetta',
|
257 |
+
'Campobasso', 'Caserta', 'Catania', 'Catanzaro', 'Chieti',
|
258 |
+
'Cosenza', 'Cremona', 'Crotone', 'Enna', 'Ferrara', 'Firenze',
|
259 |
+
'Foggia', 'Frosinone', 'Genova', 'Gorizia', 'Grosseto', 'Imperia',
|
260 |
+
'Isernia', 'La Spezia', 'Latina', 'Lecce', 'Livorno', 'Lodi',
|
261 |
+
'Lucca', 'Macerata', 'Mantova', 'Matera', 'Messina', 'Milano',
|
262 |
+
'Modena', 'Napoli', 'Novara', 'Nuoro', 'Oristano', 'Padova',
|
263 |
+
'Palermo', 'Parma', 'Pavia', 'Perugia', 'Pesaro e Urbino',
|
264 |
+
'Pescara', 'Piacenza', 'Pisa', 'Pistoia', 'Pordenone', 'Potenza',
|
265 |
+
'Prato', 'Ragusa', 'Ravenna', 'Reggio di Calabria',
|
266 |
+
"Reggio nell'Emilia", 'Rimini', 'Roma', 'Rovigo', 'Salerno',
|
267 |
+
'Sassari', 'Savona', 'Siena', 'Siracusa', 'Taranto', 'Teramo',
|
268 |
+
'Terni', 'Torino', 'Trapani', 'Treviso', 'Trieste', 'Udine',
|
269 |
+
'Varese', 'Venezia', 'Verbano-Cusio-Ossola', 'Vercelli', 'Verona',
|
270 |
+
'Vibo Valentia', 'Vicenza', 'Viterbo', 'Carbonia-Iglesias',
|
271 |
+
'Medio Campidano', 'Ogliastra', 'Olbia-Tempio', 'Barletta-Andria-Trani',
|
272 |
+
'Fermo', 'Monza e della Brianza'])
|
273 |
+
|
274 |
+
|
275 |
+
output4=""
|
276 |
+
|
277 |
+
input_dict4 = {'T2M_MAX': temperature_max, 'T2M_MIN':temperature_min,'RH2M' : relative_humidity, 'total_area_ha': total_area_ha,
|
278 |
+
'GWETROOT' : root_moisture, 'Type_crop' : crop, 'Type_fertilizer': fertilizer, 'Fertilizers_tonnes': fertilizer_tonnes ,'City' : city}
|
279 |
+
input_df4 = pd.DataFrame([input_dict4])
|
280 |
+
|
281 |
+
if st.button("Predict Fresh Vegetables"):
|
282 |
+
output4 = predict4(model4=model4, input_df4=input_df4)
|
283 |
+
output4 = 'Tons ' + "{:.2f}".format(output4)
|
284 |
+
|
285 |
+
st.success('The output is {}'.format(output4))
|
286 |
+
|
287 |
+
|
288 |
+
|
289 |
+
if add_selectbox == 'Industrial crops':
|
290 |
+
|
291 |
+
temperature_max = st.number_input('Temperature max (°C)', min_value= 20, max_value= 50)
|
292 |
+
|
293 |
+
temperature_min = st.number_input('Temperature min (°C)', min_value= -5, max_value= 20)
|
294 |
+
|
295 |
+
relative_humidity = st.number_input('Relative humidity (%)', min_value=0, max_value=100)
|
296 |
+
|
297 |
+
root_moisture = st.number_input('Root moisture', max_value=1)
|
298 |
+
|
299 |
+
total_area_ha = st.number_input('Total area(ha)', min_value=0, max_value=1440)
|
300 |
+
|
301 |
+
fertilizer_tonnes = st.number_input('Fertilizer (tonnes)', min_value=0, max_value=4824)
|
302 |
+
|
303 |
+
fertilizer = st.selectbox('Type of fertilizer', ['calcium cyanamide', 'nitrogen-potassium', 'peaty-amend',
|
304 |
+
'organic-nitrogen', 'organic', 'ammonium sulphate',
|
305 |
+
'nitrogen-phosphorous', 'phosphorus-potassium', 'urea'])
|
306 |
+
|
307 |
+
crop = st.selectbox('Type of crop', ['hemp', 'rape', 'soya beans', 'tobacco', 'flax', 'parsley-field',
|
308 |
+
'sunflower'])
|
309 |
+
|
310 |
+
city = st.selectbox('City', ['Alessandria', 'Ancona', 'Arezzo', 'Ascoli Piceno', 'Asti',
|
311 |
+
'Avellino', 'Bari', 'Belluno', 'Benevento', 'Bergamo', 'Biella',
|
312 |
+
'Bologna', 'Brescia', 'Caltanissetta', 'Campobasso', 'Caserta',
|
313 |
+
'Catania', 'Catanzaro', 'Chieti', 'Como', 'Cosenza', 'Cremona',
|
314 |
+
'Crotone', 'Ferrara', 'Firenze', 'Foggia', 'Frosinone', 'Genova',
|
315 |
+
'Gorizia', 'Grosseto', 'Imperia', 'Isernia', 'Latina', 'Lecco',
|
316 |
+
'Livorno', 'Lodi', 'Lucca', 'Macerata', 'Mantova', 'Matera',
|
317 |
+
'Milano', 'Modena', 'Napoli', 'Novara', 'Nuoro', 'Oristano',
|
318 |
+
'Padova', 'Parma', 'Pavia', 'Perugia', 'Pescara', 'Piacenza',
|
319 |
+
'Pisa', 'Pistoia', 'Pordenone', 'Potenza', 'Prato', 'Ravenna',
|
320 |
+
"Reggio nell'Emilia", 'Rieti', 'Rimini', 'Roma', 'Rovigo',
|
321 |
+
'Salerno', 'Sassari', 'Savona', 'Siena', 'Taranto', 'Teramo',
|
322 |
+
'Terni', 'Torino', 'Treviso', 'Trieste', 'Udine', 'Varese',
|
323 |
+
'Venezia', 'Verbano-Cusio-Ossola', 'Vercelli', 'Verona', 'Vicenza',
|
324 |
+
'Viterbo', 'Carbonia-Iglesias', 'Medio Campidano', 'Ogliastra',
|
325 |
+
'Vibo Valentia', 'Barletta-Andria-Trani', 'Fermo',
|
326 |
+
'Monza e della Brianza', 'La Spezia'])
|
327 |
+
|
328 |
+
|
329 |
+
output5=""
|
330 |
+
|
331 |
+
input_dict5 = {'T2M_MAX': temperature_max, 'T2M_MIN':temperature_min,'RH2M' : relative_humidity, 'total_area_ha': total_area_ha,
|
332 |
+
'GWETROOT' : root_moisture, 'Type_crop' : crop, 'Type_fertilizer': fertilizer, 'Fertilizers_tonnes': fertilizer_tonnes ,'City' : city}
|
333 |
+
input_df5 = pd.DataFrame([input_dict5])
|
334 |
|
335 |
+
if st.button("Predict Industrial crops"):
|
336 |
+
output5 = predict5(model5=model5, input_df5=input_df5)
|
337 |
+
output5 = 'Tons ' + "{:.2f}".format(output5)
|
338 |
+
|
339 |
+
st.success('The output is {}'.format(output5))
|
340 |
|
341 |
+
if __name__ == '__main__':
|
342 |
+
|
343 |
+
run()
|
344 |
+
|
requirements.txt
CHANGED
@@ -2,4 +2,5 @@ streamlit-option-menu
|
|
2 |
geopandas
|
3 |
millify
|
4 |
folium
|
5 |
-
streamlit_folium
|
|
|
|
2 |
geopandas
|
3 |
millify
|
4 |
folium
|
5 |
+
streamlit_folium
|
6 |
+
pycaret==3.0.0rc2
|