Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import joblib | |
| model = joblib.load("crop_predict.pkl") | |
| def crop_predict(N, P, K, temperature, humidity, ph, rainfall): | |
| vals = [float(N), float(P), float(K), float(temperature), float(humidity), float(ph), float(rainfall)] | |
| out = model.predict([vals]) | |
| return str(out[0]) | |
| demo = gr.Interface( | |
| fn=crop_predict, | |
| inputs=[ | |
| gr.Textbox(label="N"), | |
| gr.Textbox(label="P"), | |
| gr.Textbox(label="K"), | |
| gr.Textbox(label="temperature"), | |
| gr.Textbox(label="humidity"), | |
| gr.Textbox(label="ph"), | |
| gr.Textbox(label="rainfall") | |
| ], | |
| outputs=gr.Textbox() | |
| ) |