Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -280,7 +280,7 @@ with col_output:
|
|
| 280 |
|
| 281 |
## Get Sales Prediction Value
|
| 282 |
prediction_from_backend = result.get ("prediction") # Extract only the value
|
| 283 |
-
probability =
|
| 284 |
|
| 285 |
# generate output string
|
| 286 |
if prediction_from_backend == 1:
|
|
@@ -345,10 +345,18 @@ if file is not None and st.button("Predict Batch"):
|
|
| 345 |
## Get Sales Prediction Value
|
| 346 |
predictions_from_backend = result.get ("predictions") # Extract only the value
|
| 347 |
|
|
|
|
|
|
|
|
|
|
| 348 |
# Convert list → DataFrame
|
| 349 |
result_df = pd.DataFrame({
|
| 350 |
"Prediction": predictions_from_backend
|
| 351 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
|
| 353 |
st.dataframe (result_df)
|
| 354 |
|
|
@@ -358,7 +366,8 @@ if file is not None and st.button("Predict Batch"):
|
|
| 358 |
if len(predictions_from_backend) == len(input_df):
|
| 359 |
|
| 360 |
# Add prediction column
|
| 361 |
-
input_df["Prediction"]
|
|
|
|
| 362 |
|
| 363 |
st.success("Batch prediction completed successfully")
|
| 364 |
|
|
|
|
| 280 |
|
| 281 |
## Get Sales Prediction Value
|
| 282 |
prediction_from_backend = result.get ("prediction") # Extract only the value
|
| 283 |
+
probability = result.get ("probability") # Extract only the value
|
| 284 |
|
| 285 |
# generate output string
|
| 286 |
if prediction_from_backend == 1:
|
|
|
|
| 345 |
## Get Sales Prediction Value
|
| 346 |
predictions_from_backend = result.get ("predictions") # Extract only the value
|
| 347 |
|
| 348 |
+
## get probabbilities from back end
|
| 349 |
+
probabilities = result.get ("probabilities") # Extract only the value
|
| 350 |
+
|
| 351 |
# Convert list → DataFrame
|
| 352 |
result_df = pd.DataFrame({
|
| 353 |
"Prediction": predictions_from_backend
|
| 354 |
})
|
| 355 |
+
|
| 356 |
+
# probability
|
| 357 |
+
result_df_prob = pd.DataFrame({
|
| 358 |
+
"Probability": probabilities
|
| 359 |
+
})
|
| 360 |
|
| 361 |
st.dataframe (result_df)
|
| 362 |
|
|
|
|
| 366 |
if len(predictions_from_backend) == len(input_df):
|
| 367 |
|
| 368 |
# Add prediction column
|
| 369 |
+
input_df["Prediction"] = predictions_from_backend
|
| 370 |
+
input_df["Probability"] = probabilities
|
| 371 |
|
| 372 |
st.success("Batch prediction completed successfully")
|
| 373 |
|