Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ input_data = pd.DataFrame([{
|
|
| 34 |
|
| 35 |
# Make prediction when the "Predict" button is clicked
|
| 36 |
if st.button("Predict"):
|
| 37 |
-
response = requests.post("https://sandtemp01-
|
| 38 |
if response.status_code == 200:
|
| 39 |
prediction = response.json()['Predicted Price (in dollars)']
|
| 40 |
st.success(f"Predicted Rental Price (in dollars): {prediction}")
|
|
@@ -50,7 +50,7 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 50 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 51 |
if uploaded_file is not None:
|
| 52 |
if st.button("Predict Batch"):
|
| 53 |
-
response = requests.post("https://sandtemp01-
|
| 54 |
if response.status_code == 200:
|
| 55 |
predictions = response.json()
|
| 56 |
st.success("Batch predictions completed!")
|
|
|
|
| 34 |
|
| 35 |
# Make prediction when the "Predict" button is clicked
|
| 36 |
if st.button("Predict"):
|
| 37 |
+
response = requests.post("https://sandtemp01-RentalPricePredBE.hf.space/v1/rental", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 38 |
if response.status_code == 200:
|
| 39 |
prediction = response.json()['Predicted Price (in dollars)']
|
| 40 |
st.success(f"Predicted Rental Price (in dollars): {prediction}")
|
|
|
|
| 50 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 51 |
if uploaded_file is not None:
|
| 52 |
if st.button("Predict Batch"):
|
| 53 |
+
response = requests.post("https://sandtemp01-RentalPricePredBE.hf.space/v1/rentalbatch", files={"file": uploaded_file}) # Send file to Flask API
|
| 54 |
if response.status_code == 200:
|
| 55 |
predictions = response.json()
|
| 56 |
st.success("Batch predictions completed!")
|