Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- backend/app.py +4 -0
- frontend/Frontend_app.py +5 -2
backend/app.py
CHANGED
|
@@ -15,3 +15,7 @@ def predict():
|
|
| 15 |
df = pd.DataFrame([data])
|
| 16 |
prediction = model.predict(df)
|
| 17 |
return jsonify({"prediction": prediction.tolist()})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
df = pd.DataFrame([data])
|
| 16 |
prediction = model.predict(df)
|
| 17 |
return jsonify({"prediction": prediction.tolist()})
|
| 18 |
+
|
| 19 |
+
# Run the Flask application in debug mode if this script is executed directly
|
| 20 |
+
if __name__ == '__main__':
|
| 21 |
+
app.run(debug=True)
|
frontend/Frontend_app.py
CHANGED
|
@@ -20,5 +20,8 @@ if st.button("Predict"):
|
|
| 20 |
"sale_volume_lag_3": lag3,
|
| 21 |
"sale_volume_lag_6": lag6
|
| 22 |
}
|
| 23 |
-
res = requests.post("
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
"sale_volume_lag_3": lag3,
|
| 21 |
"sale_volume_lag_6": lag6
|
| 22 |
}
|
| 23 |
+
res = requests.post("https://sudhirpgcmma02/Hy_prediction.hf.space/predict", json=payload)
|
| 24 |
+
if res.status_code == 200:
|
| 25 |
+
st.success(f"Prediction: {res.json()['prediction']}")
|
| 26 |
+
else:
|
| 27 |
+
st.error("Error making prediction.")
|