Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -146,12 +146,13 @@ def predict_deep_learning(model_name, file):
|
|
146 |
plt.imshow(img_data, cmap='gray', alpha=0.5)
|
147 |
plt.imshow(overlay, cmap='jet', alpha=0.5)
|
148 |
plt.title('Crop Yield Prediction Overlay')
|
149 |
-
# plt.colorbar()
|
150 |
plt.savefig('/tmp/dl_prediction_overlay.png')
|
151 |
|
152 |
return '/tmp/dl_prediction_overlay.png'
|
153 |
else:
|
154 |
return "No file uploaded"
|
|
|
|
|
155 |
else:
|
156 |
return "Model not found"
|
157 |
|
@@ -181,7 +182,7 @@ with gr.Blocks() as demo:
|
|
181 |
|
182 |
with gr.Tab("Deep Learning Models"):
|
183 |
gr.Interface(
|
184 |
-
fn=
|
185 |
inputs=inputs_deep_learning,
|
186 |
outputs=outputs_deep_learning,
|
187 |
title="Crop Yield Prediction using Deep Learning Models and Random Forest"
|
|
|
146 |
plt.imshow(img_data, cmap='gray', alpha=0.5)
|
147 |
plt.imshow(overlay, cmap='jet', alpha=0.5)
|
148 |
plt.title('Crop Yield Prediction Overlay')
|
|
|
149 |
plt.savefig('/tmp/dl_prediction_overlay.png')
|
150 |
|
151 |
return '/tmp/dl_prediction_overlay.png'
|
152 |
else:
|
153 |
return "No file uploaded"
|
154 |
+
elif model_name == 'Random Forest':
|
155 |
+
return predict_random_forest(file)
|
156 |
else:
|
157 |
return "Model not found"
|
158 |
|
|
|
182 |
|
183 |
with gr.Tab("Deep Learning Models"):
|
184 |
gr.Interface(
|
185 |
+
fn=predict_deep_learning,
|
186 |
inputs=inputs_deep_learning,
|
187 |
outputs=outputs_deep_learning,
|
188 |
title="Crop Yield Prediction using Deep Learning Models and Random Forest"
|