Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,30 +13,18 @@ st.title("Crop Recommendation System 🌱")
|
|
| 13 |
# Create a sidebar for input fields
|
| 14 |
with st.sidebar:
|
| 15 |
st.header("Input Parameters")
|
| 16 |
-
N = st.
|
| 17 |
-
P = st.
|
| 18 |
-
K = st.
|
| 19 |
-
temp = st.
|
| 20 |
-
humidity = st.
|
| 21 |
-
ph = st.
|
| 22 |
-
rainfall = st.
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# Create a sidebar for input fields
|
| 26 |
-
with st.sidebar:
|
| 27 |
-
st.header("Input Parameters")
|
| 28 |
-
N = st.number_input("Nitrogen content", min_value=0.0, step=0.1, help="Enter Nitrogen content")
|
| 29 |
-
P = st.number_input("Phosphorus content", min_value=0.0, step=0.1, help="Enter Phosphorus content")
|
| 30 |
-
K = st.number_input("Potassium content", min_value=0.0, step=0.1, help="Enter Potassium content")
|
| 31 |
-
temp = st.number_input("Temperature in °C", min_value=0.0, step=0.1, help="Enter Temperature in °C")
|
| 32 |
-
humidity = st.number_input("Humidity in %", min_value=0.0, step=0.1, help="Enter Humidity in %")
|
| 33 |
-
ph = st.number_input("pH value", min_value=0.0, step=0.1, help="Enter pH value")
|
| 34 |
-
rainfall = st.number_input("Rainfall in mm", min_value=0.0, step=0.1, help="Enter Rainfall in mm")
|
| 35 |
|
| 36 |
if st.button("Get Recommendation"):
|
| 37 |
feature_list = [N, P, K, temp, humidity, ph, rainfall]
|
| 38 |
single_pred = np.array(feature_list).reshape(1, -1)
|
| 39 |
-
|
| 40 |
scaled_features = ms.transform(single_pred)
|
| 41 |
final_features = sc.transform(scaled_features)
|
| 42 |
prediction = model.predict(final_features)
|
|
|
|
| 13 |
# Create a sidebar for input fields
|
| 14 |
with st.sidebar:
|
| 15 |
st.header("Input Parameters")
|
| 16 |
+
N = st.number_input("Nitrogen content", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Nitrogen content")
|
| 17 |
+
P = st.number_input("Phosphorus content", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Phosphorus content")
|
| 18 |
+
K = st.number_input("Potassium content", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Potassium content")
|
| 19 |
+
temp = st.number_input("Temperature in °C", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Temperature in °C")
|
| 20 |
+
humidity = st.number_input("Humidity in %", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Humidity in %")
|
| 21 |
+
ph = st.number_input("pH value", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter pH value")
|
| 22 |
+
rainfall = st.number_input("Rainfall in mm", min_value=0.0, value=0.0, step=0.1, format="%.1f", help="Enter Rainfall in mm")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
if st.button("Get Recommendation"):
|
| 25 |
feature_list = [N, P, K, temp, humidity, ph, rainfall]
|
| 26 |
single_pred = np.array(feature_list).reshape(1, -1)
|
| 27 |
+
|
| 28 |
scaled_features = ms.transform(single_pred)
|
| 29 |
final_features = sc.transform(scaled_features)
|
| 30 |
prediction = model.predict(final_features)
|