Spaces:
Sleeping
Sleeping
shubham5027
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -7,37 +7,7 @@ import os
|
|
7 |
working_dir = os.path.dirname(os.path.abspath(__file__))
|
8 |
model = pickle.load(open(f'{working_dir}/RF_Crop.sav', 'rb'))
|
9 |
|
10 |
-
# Overview section content
|
11 |
-
overview_text = """
|
12 |
-
### Welcome to the Crop Recommendation App!
|
13 |
|
14 |
-
This application assists farmers in selecting the optimal crop to cultivate, considering soil composition
|
15 |
-
and environmental conditions. By providing information such as nitrogen, phosphorus, and
|
16 |
-
potassium levels, as well as temperature, humidity, pH, and rainfall, users receive tailored
|
17 |
-
recommendations for the most suitable crop out of a selection of 22 options.
|
18 |
-
|
19 |
-
### How to Use the App
|
20 |
-
1. Navigate to the "Crop Recommendation" section.
|
21 |
-
2. Enter the values for the soil and environmental factors in the input fields.
|
22 |
-
3. Click the "Predict" button to get the crop recommendation.
|
23 |
-
|
24 |
-
### About the Model
|
25 |
-
The recommendation is made using a Random Forest model trained on agricultural data.
|
26 |
-
This model considers various factors to predict the best crop for your field.
|
27 |
-
The model has been developed by analyzing many models like SVM, Random Forest,
|
28 |
-
Decision Tree, Logistic Regression, Gaussian Naive Bayes. Random Forest has been selected based on
|
29 |
-
the Cross Validation Accuracy & Test Accuracy.
|
30 |
-
|
31 |
-
### Benefits of Using Crop Recommendation
|
32 |
-
- **Increased Yield**: By planting the most suitable crop, you can maximize your harvest.
|
33 |
-
- **Cost Efficiency**: Avoid wasting resources on crops that are not suited to your soil and climate.
|
34 |
-
- **Sustainable Farming**: Promote better land use and reduce environmental impact.
|
35 |
-
|
36 |
-
### Contact Us
|
37 |
-
If you have any questions or feedback about the project, feel free to reach out:
|
38 |
-
- **Email**: kanchanrai2307@gmail.com
|
39 |
-
- **Github**: [kanchanrai7](https://github.com/kanchanrai7)
|
40 |
-
"""
|
41 |
|
42 |
# Define the prediction function
|
43 |
def predict_crop(N, P, K, temperature, humidity, pH, rainfall):
|
|
|
7 |
working_dir = os.path.dirname(os.path.abspath(__file__))
|
8 |
model = pickle.load(open(f'{working_dir}/RF_Crop.sav', 'rb'))
|
9 |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Define the prediction function
|
13 |
def predict_crop(N, P, K, temperature, humidity, pH, rainfall):
|