Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,56 +1,57 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import joblib
|
3 |
-
|
4 |
-
html_temp = """
|
5 |
-
<div style="background-color:lightgreen;padding:10px">
|
6 |
-
<h2 style="color:white;text-align:center;">Crop Yeid Prediction </h2>
|
7 |
-
</div>
|
8 |
-
"""
|
9 |
-
st.markdown(html_temp, unsafe_allow_html=True)
|
10 |
-
|
11 |
-
image_url="https://miro.medium.com/v2/resize:fit:1358/0*k-lYNf3gZ1M2u6AN"
|
12 |
-
|
13 |
-
st.image(image_url, use_container_width=True)
|
14 |
-
|
15 |
-
# Area
|
16 |
-
options_Area = ['Albania', 'Algeria', 'Angola', 'Argentina', 'Armenia','Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain',
|
17 |
-
'Bangladesh', 'Belarus', 'Belgium', 'Botswana', 'Brazil','Bulgaria', 'Burkina Faso', 'Burundi', 'Cameroon', 'Canada',
|
18 |
-
'Central African Republic', 'Chile', 'Colombia', 'Croatia',
|
19 |
-
'Denmark', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador','Eritrea', 'Estonia', 'Finland', 'France', 'Germany', 'Ghana',
|
20 |
-
'Greece', 'Guatemala', 'Guinea', 'Guyana', 'Haiti', 'Honduras',
|
21 |
-
'Hungary', 'India', 'Indonesia', 'Iraq', 'Ireland', 'Italy',
|
22 |
-
'Jamaica', 'Japan', 'Kazakhstan', 'Kenya', 'Latvia', 'Lebanon',
|
23 |
-
'Lesotho', 'Libya', 'Lithuania', 'Madagascar', 'Malawi',
|
24 |
-
'Malaysia', 'Mali', 'Mauritania', 'Mauritius', 'Mexico',
|
25 |
-
'Montenegro', 'Morocco', 'Mozambique', 'Namibia', 'Nepal',
|
26 |
-
'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Norway',
|
27 |
-
'Pakistan', 'Papua New Guinea', 'Peru', 'Poland', 'Portugal',
|
28 |
-
'Qatar', 'Romania', 'Rwanda', 'Saudi Arabia', 'Senegal',
|
29 |
-
'Slovenia', 'South Africa', 'Spain', 'Sri Lanka', 'Sudan',
|
30 |
-
'Suriname', 'Sweden', 'Switzerland', 'Tajikistan', 'Thailand',
|
31 |
-
'Tunisia', 'Turkey', 'Uganda', 'Ukraine', 'United Kingdom',
|
32 |
-
'Uruguay', 'Zambia', 'Zimbabwe']
|
33 |
-
Area= st.selectbox('Choose an Area:', options_Area)
|
34 |
-
Area_value=options_Area.index(Area)
|
35 |
-
|
36 |
-
# Item
|
37 |
-
options_Item =['Maize','Potatoes', 'Rice, paddy', 'Sorghum', 'Soybeans',
|
38 |
-
'Wheat','Cassava', 'Sweet potatoes', 'Plantains and others', 'Yams']
|
39 |
-
Item= st.selectbox('Choose a Item:', options_Item)
|
40 |
-
Item_value=options_Item.index(Item)
|
41 |
-
|
42 |
-
# average_rain_fall_mm_per_year
|
43 |
-
avg_rainfall=st.slider('Slide The value to get Avg Rainfall',min_value=51,max_value=3240,value=51)
|
44 |
-
|
45 |
-
# Pesticides_tonnes
|
46 |
-
pes_tonnes=st.slider('Slide The value to get Pesticides in Tonnes',min_value=1,max_value=367778,value=1)
|
47 |
-
|
48 |
-
# Avg Temp
|
49 |
-
avg_temp=st.slider('Slide The value to get Avg Temperature',min_value=1,max_value=30,value=1)
|
50 |
-
|
51 |
-
model=joblib.load("crop_yield_model_rf.joblib")
|
52 |
-
|
53 |
-
if st.button("Enter"):
|
54 |
-
output=model.predict([[Area_value,Item_value,avg_rainfall,pes_tonnes,avg_temp]])
|
55 |
-
|
56 |
-
st.write("The Predicted Value of Yield:",output)
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import joblib
|
3 |
+
|
4 |
+
html_temp = """
|
5 |
+
<div style="background-color:lightgreen;padding:10px">
|
6 |
+
<h2 style="color:white;text-align:center;">Crop Yeid Prediction </h2>
|
7 |
+
</div>
|
8 |
+
"""
|
9 |
+
st.markdown(html_temp, unsafe_allow_html=True)
|
10 |
+
|
11 |
+
image_url="https://miro.medium.com/v2/resize:fit:1358/0*k-lYNf3gZ1M2u6AN"
|
12 |
+
|
13 |
+
st.image(image_url, use_container_width=True)
|
14 |
+
|
15 |
+
# Area
|
16 |
+
options_Area = ['Albania', 'Algeria', 'Angola', 'Argentina', 'Armenia','Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain',
|
17 |
+
'Bangladesh', 'Belarus', 'Belgium', 'Botswana', 'Brazil','Bulgaria', 'Burkina Faso', 'Burundi', 'Cameroon', 'Canada',
|
18 |
+
'Central African Republic', 'Chile', 'Colombia', 'Croatia',
|
19 |
+
'Denmark', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador','Eritrea', 'Estonia', 'Finland', 'France', 'Germany', 'Ghana',
|
20 |
+
'Greece', 'Guatemala', 'Guinea', 'Guyana', 'Haiti', 'Honduras',
|
21 |
+
'Hungary', 'India', 'Indonesia', 'Iraq', 'Ireland', 'Italy',
|
22 |
+
'Jamaica', 'Japan', 'Kazakhstan', 'Kenya', 'Latvia', 'Lebanon',
|
23 |
+
'Lesotho', 'Libya', 'Lithuania', 'Madagascar', 'Malawi',
|
24 |
+
'Malaysia', 'Mali', 'Mauritania', 'Mauritius', 'Mexico',
|
25 |
+
'Montenegro', 'Morocco', 'Mozambique', 'Namibia', 'Nepal',
|
26 |
+
'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Norway',
|
27 |
+
'Pakistan', 'Papua New Guinea', 'Peru', 'Poland', 'Portugal',
|
28 |
+
'Qatar', 'Romania', 'Rwanda', 'Saudi Arabia', 'Senegal',
|
29 |
+
'Slovenia', 'South Africa', 'Spain', 'Sri Lanka', 'Sudan',
|
30 |
+
'Suriname', 'Sweden', 'Switzerland', 'Tajikistan', 'Thailand',
|
31 |
+
'Tunisia', 'Turkey', 'Uganda', 'Ukraine', 'United Kingdom',
|
32 |
+
'Uruguay', 'Zambia', 'Zimbabwe']
|
33 |
+
Area= st.selectbox('Choose an Area:', options_Area)
|
34 |
+
Area_value=options_Area.index(Area)
|
35 |
+
|
36 |
+
# Item
|
37 |
+
options_Item =['Maize','Potatoes', 'Rice, paddy', 'Sorghum', 'Soybeans',
|
38 |
+
'Wheat','Cassava', 'Sweet potatoes', 'Plantains and others', 'Yams']
|
39 |
+
Item= st.selectbox('Choose a Item:', options_Item)
|
40 |
+
Item_value=options_Item.index(Item)
|
41 |
+
|
42 |
+
# average_rain_fall_mm_per_year
|
43 |
+
avg_rainfall=st.slider('Slide The value to get Avg Rainfall',min_value=51,max_value=3240,value=51)
|
44 |
+
|
45 |
+
# Pesticides_tonnes
|
46 |
+
pes_tonnes=st.slider('Slide The value to get Pesticides in Tonnes',min_value=1,max_value=367778,value=1)
|
47 |
+
|
48 |
+
# Avg Temp
|
49 |
+
avg_temp=st.slider('Slide The value to get Avg Temperature',min_value=1,max_value=30,value=1)
|
50 |
+
|
51 |
+
model=joblib.load("crop_yield_model_rf.joblib")
|
52 |
+
|
53 |
+
if st.button("Enter"):
|
54 |
+
output=model.predict([[Area_value,Item_value,avg_rainfall,pes_tonnes,avg_temp]])
|
55 |
+
|
56 |
+
st.write("The Predicted Value of Yield:",output)
|
57 |
+
|