Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 68c72bb

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in cdc1f32 according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/1c3a1251-a6cd-4e7c-b80d-0b63b1d80a2a/
1 parent cdc1f32 commit 68c72bb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎Agriculture Optimization ML Model/streamlit.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@
88
data = pd.read_excel("data.xlsx")
99
y = data['label']
1010
X = data.drop(["label"], axis=1)
11-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
11+
X_train, X_test, y_train, y_test = train_test_split(
12+
X, y, test_size=0.3, random_state=0)
1213
lr = LogisticRegression()
1314
lr.fit(X_train, y_train)
15+
16+
1417
def predict_crop(input_data):
1518
crop_label = lr.predict(input_data)
1619
return crop_label[0]
20+
21+
1722
def main():
1823
st.title("Agriculture Optimisation App")
1924
st.write("Enter the parameter values to predict the crop label:")
2025

21-
2226
n = st.number_input("N", value=0.0)
2327
p = st.number_input("P", value=0.0)
2428
k = st.number_input("K", value=0.0)
@@ -27,16 +31,13 @@ def main():
2731
ph = st.number_input("pH", value=0.0)
2832
rainfall = st.number_input("Rainfall", value=0.0)
2933

30-
3134
input_data = np.array([[n, p, k, temperature, humidity, ph, rainfall]])
3235

33-
34-
3536
crop_label = predict_crop(input_data)
3637

37-
3838
st.subheader("Predicted Crop Label:")
3939
st.write(crop_label)
4040

41+
4142
if __name__ == '__main__':
4243
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /