harishsohani commited on
Commit
7fa1a50
·
verified ·
1 Parent(s): 72ee4a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -242,6 +242,14 @@ with col_output:
242
  #st.markdown('<div class="card output-card">', unsafe_allow_html=True)
243
 
244
  #st.markdown('<div class="section-title">🧠 Prediction Result</div>', unsafe_allow_html=True)
 
 
 
 
 
 
 
 
245
 
246
  output_placeholder = st.empty()
247
  details_placeholder = st.empty()
@@ -278,19 +286,24 @@ with col_output:
278
 
279
  if resp_status == "success":
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:
287
  output_placeholder.error("⚠️ Engine likely needs maintenance")
288
  else:
289
  output_placeholder.success("✅ Engine operating normally")
 
 
 
 
290
 
291
  details_placeholder.markdown(f"""
292
- **Failure Probability:** {probability}
293
-
294
  **Model:** XGBoost
295
  **Threshold:** 0.5
296
  **Inference:** Real-time
@@ -316,7 +329,7 @@ with col_output:
316
  else:
317
  output_placeholder.error(f"⚠️ Error processing request- Status Code : {response.status_code}")
318
 
319
- #st.markdown('</div>', unsafe_allow_html=True)
320
 
321
  # ==============================
322
  # Batch Prediction
 
242
  #st.markdown('<div class="card output-card">', unsafe_allow_html=True)
243
 
244
  #st.markdown('<div class="section-title">🧠 Prediction Result</div>', unsafe_allow_html=True)
245
+ st.markdown("""
246
+ <div style="
247
+ border:2px solid #22c55e;
248
+ border-radius:16px;
249
+ padding:20px;
250
+ background-color:#111827;
251
+ ">
252
+ """, unsafe_allow_html=True)
253
 
254
  output_placeholder = st.empty()
255
  details_placeholder = st.empty()
 
286
 
287
  if resp_status == "success":
288
 
289
+ ## Get Sales Prediction, probability Values
290
  prediction_from_backend = result.get ("prediction") # Extract only the value
291
  probability = result.get ("probability") # Extract only the value
292
+
293
+ # convert probability into % for representation
294
+ formatted_prob = f"{probability * 100:.2f}%"
295
 
296
  # generate output string
297
  if prediction_from_backend == 1:
298
  output_placeholder.error("⚠️ Engine likely needs maintenance")
299
  else:
300
  output_placeholder.success("✅ Engine operating normally")
301
+
302
+ st.metric("Failure Probability", formatted_prob)
303
+
304
+ st.markdown("---")
305
 
306
  details_placeholder.markdown(f"""
 
 
307
  **Model:** XGBoost
308
  **Threshold:** 0.5
309
  **Inference:** Real-time
 
329
  else:
330
  output_placeholder.error(f"⚠️ Error processing request- Status Code : {response.status_code}")
331
 
332
+ st.markdown('</div>', unsafe_allow_html=True)
333
 
334
  # ==============================
335
  # Batch Prediction