Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,6 +101,25 @@ def predict_crop_parameters(crop_name):
|
|
| 101 |
formatted_output = "\n".join([f"<b>{k}</b>: {v}" for k, v in predictions.items()])
|
| 102 |
return formatted_output
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
|
|
|
|
| 101 |
formatted_output = "\n".join([f"<b>{k}</b>: {v}" for k, v in predictions.items()])
|
| 102 |
return formatted_output
|
| 103 |
|
| 104 |
+
def predict_crop_parameters(crop_name):
|
| 105 |
+
crop_name_lower = crop_name.lower()
|
| 106 |
+
if crop_name_lower not in label_to_encoded:
|
| 107 |
+
return f"❌ '<b>{crop_name}</b>' ਲਈ ਡਾਟਾ ਨਹੀਂ ਮਿਲਿਆ।"
|
| 108 |
+
|
| 109 |
+
encoded_value = label_to_encoded[crop_name_lower]
|
| 110 |
+
input_data = [[encoded_value]]
|
| 111 |
+
|
| 112 |
+
predictions = {}
|
| 113 |
+
for param, model_r in reverse_models.items():
|
| 114 |
+
predicted_value = model_r.predict(input_data)[0]
|
| 115 |
+
predictions[param] = round(predicted_value, 2)
|
| 116 |
+
|
| 117 |
+
formatted_output = ""
|
| 118 |
+
for k, v in predictions.items():
|
| 119 |
+
formatted_output += f"<b>{k}</b>: {v}<br>"
|
| 120 |
+
|
| 121 |
+
return formatted_output
|
| 122 |
+
|
| 123 |
|
| 124 |
|
| 125 |
|