krishnamishra8848 commited on
Commit
584ae9a
·
verified ·
1 Parent(s): cddda03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -44,16 +44,19 @@ if uploaded_file is not None:
44
  prediction, confidence = predict_image(temp_file_path)
45
  os.remove(temp_file_path) # Clean up the temporary file
46
 
 
 
 
47
  # Display the result
48
  if prediction > 0.5:
49
  st.markdown(
50
- f"<h2 style='color:red;'>Prediction: Tumor Detected with {confidence:.2f} confidence.</h2>",
51
  unsafe_allow_html=True
52
  )
53
  st.write("**Note:** Consult a medical professional for further evaluation.")
54
  else:
55
  st.markdown(
56
- f"<h2 style='color:green;'>Prediction: Healthy with {confidence:.2f} confidence.</h2>",
57
  unsafe_allow_html=True
58
  )
59
  st.write("**Note:** The result suggests a healthy scan. Regular checkups are recommended.")
 
44
  prediction, confidence = predict_image(temp_file_path)
45
  os.remove(temp_file_path) # Clean up the temporary file
46
 
47
+ # Convert confidence to percentage
48
+ confidence_percentage = confidence * 100
49
+
50
  # Display the result
51
  if prediction > 0.5:
52
  st.markdown(
53
+ f"<h2 style='color:red;'>Prediction: Tumor Detected with {confidence_percentage:.2f}% confidence.</h2>",
54
  unsafe_allow_html=True
55
  )
56
  st.write("**Note:** Consult a medical professional for further evaluation.")
57
  else:
58
  st.markdown(
59
+ f"<h2 style='color:green;'>Prediction: Healthy with {confidence_percentage:.2f}% confidence.</h2>",
60
  unsafe_allow_html=True
61
  )
62
  st.write("**Note:** The result suggests a healthy scan. Regular checkups are recommended.")