pushpinder06 commited on
Commit
9626864
·
verified ·
1 Parent(s): 65a7274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -47,6 +47,13 @@ def predict_crop(N, P, K, temperature, humidity, ph, rainfall):
47
  # ---------------------------
48
  # Reverse Prediction Setup
49
  # ---------------------------
 
 
 
 
 
 
 
50
  data['crop_encoded'] = le.transform(data['label'])
51
  reverse_X = data[['crop_encoded']]
52
  y_cols = ['N', 'P', 'K', 'temperature', 'humidity', 'ph', 'rainfall']
@@ -177,7 +184,7 @@ with gr.Blocks() as demo:
177
  predict_btn.click(predict_crop, inputs=[N, P, K, temperature, humidity, ph, rainfall], outputs=crop_output)
178
 
179
  with gr.TabItem("🔁 ਫਸਲ ਤੋਂ ਪੈਰਾਮੀਟਰ"):
180
- crop_input = gr.Textbox(label="🌿 ਫਸਲ ਦਾ ਨਾਂ ਲਿਖੋ")
181
  result_output = gr.JSON(label="🧪 ਅਨੁਕੂਲ ਪੈਰਾਮੀਟਰ")
182
  run_btn = gr.Button("➡️ ਭਵਿੱਖਬਾਣੀ ਲਵੋ")
183
  run_btn.click(fn=predict_crop_parameters, inputs=[crop_input], outputs=[result_output])
 
47
  # ---------------------------
48
  # Reverse Prediction Setup
49
  # ---------------------------
50
+
51
+ crops = [
52
+ 'ਚੌਲ', 'ਮੱਕੀ', 'ਚਣਾ', 'ਰਾਜ਼ਮਾ', 'ਅੜਦ', 'ਮੋਥ',
53
+ 'ਮੂੰਗ', 'ਉੜਦ', 'ਮਸਰ', 'ਅਨਾਰ', 'ਕੇਲਾ', 'ਆਮ',
54
+ 'ਤਰਬੂਜ਼', 'ਖਰਬੂਜ਼ਾ', 'ਸੰਤਰਾ', 'ਪਪੀਤਾ', 'ਨਾਰੀਅਲ', 'ਕਾਪਾਸ',
55
+ 'ਜੂਟ', 'ਕੌਫ਼ੀ'
56
+ ]
57
  data['crop_encoded'] = le.transform(data['label'])
58
  reverse_X = data[['crop_encoded']]
59
  y_cols = ['N', 'P', 'K', 'temperature', 'humidity', 'ph', 'rainfall']
 
184
  predict_btn.click(predict_crop, inputs=[N, P, K, temperature, humidity, ph, rainfall], outputs=crop_output)
185
 
186
  with gr.TabItem("🔁 ਫਸਲ ਤੋਂ ਪੈਰਾਮੀਟਰ"):
187
+ crop_input = gr.Dropdown(choices=crops label="🌿 ਫਸਲ ਦਾ ਨਾਂ ਲਿਖੋ")
188
  result_output = gr.JSON(label="🧪 ਅਨੁਕੂਲ ਪੈਰਾਮੀਟਰ")
189
  run_btn = gr.Button("➡️ ਭਵਿੱਖਬਾਣੀ ਲਵੋ")
190
  run_btn.click(fn=predict_crop_parameters, inputs=[crop_input], outputs=[result_output])