Update app.py
Browse files
app.py
CHANGED
@@ -117,23 +117,5 @@ if st.button("Predict"):
|
|
117 |
}
|
118 |
# Send a POST request to the FastAPI server
|
119 |
response = requests.post("https://rasmodev-income-prediction-fastapi.hf.space/predict", json=user_input)
|
120 |
-
|
121 |
-
|
122 |
-
if response.status_code == 200:
|
123 |
-
prediction_data = response.json()
|
124 |
-
|
125 |
-
# Display prediction result to the user
|
126 |
-
st.subheader("Prediction Result")
|
127 |
-
|
128 |
-
# Determine income prediction and format message
|
129 |
-
if prediction_data['income_prediction'] == "Income over $50K":
|
130 |
-
st.success("This individual is predicted to have an income of over $50K.")
|
131 |
-
else:
|
132 |
-
st.error("This individual is predicted to have an income of under $50K")
|
133 |
-
|
134 |
-
# Display prediction probability
|
135 |
-
st.subheader("Prediction Probability")
|
136 |
-
probability = prediction_data['prediction_probability']
|
137 |
-
st.write(f"The probability of the individual having an income over $50K is: {probability:.2f}")
|
138 |
-
else:
|
139 |
-
st.error("Error: Unable to get prediction")
|
|
|
117 |
}
|
118 |
# Send a POST request to the FastAPI server
|
119 |
response = requests.post("https://rasmodev-income-prediction-fastapi.hf.space/predict", json=user_input)
|
120 |
+
prediction = response.text
|
121 |
+
st.success(f'This individual is predicted to have an income of:{prediction})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|