MUmairAB commited on
Commit
b0e3127
1 Parent(s): 9821f8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -16,7 +16,10 @@ def detect_cancer(img):
16
  pred = model.predict(img)
17
  #Convert the "numpy.ndarray" object to a simple numebr
18
  prediction = round(float(pred))
19
- return prediction
 
 
 
20
 
21
 
22
 
@@ -33,15 +36,19 @@ def main():
33
 
34
  h2 = "Enter the following values to know the status of your health"
35
  st.write(h2)
36
- loaded_img = st.file_uploader(label=color["Upload the Histopathological Image patch of breast"],
37
  type=None, accept_multiple_files=False,
38
  key="Img_upload_key",
39
  label_visibility="visible")
40
 
41
- if uploaded_file is not None:
42
- # Convert the file to TensorFlow image.
43
- loaded_img = np.asarray(bytearray(loaded_img.read()), dtype=np.uint8)
44
- img = load_img(loaded_img, target_size=(50,50))
45
- prediction = detect_cancer(img)
46
 
47
-
 
 
 
 
 
 
16
  pred = model.predict(img)
17
  #Convert the "numpy.ndarray" object to a simple numebr
18
  prediction = round(float(pred))
19
+ if prediction == 0:
20
+ return("Congratulation! you don't have breast cancer")
21
+ else:
22
+ return("Unfortunately! you have breast cancer. Kindly consult a doctor!")
23
 
24
 
25
 
 
36
 
37
  h2 = "Enter the following values to know the status of your health"
38
  st.write(h2)
39
+ loaded_img = st.file_uploader(label="Upload the Histopathological Image patch of breast",
40
  type=None, accept_multiple_files=False,
41
  key="Img_upload_key",
42
  label_visibility="visible")
43
 
44
+ if loaded_img is not None:
45
+ # Convert the file to TensorFlow image.
46
+ loaded_img = np.asarray(bytearray(loaded_img.read()), dtype=np.uint8)
47
+ img = load_img(loaded_img, target_size=(50,50))
 
48
 
49
+ if st.button(label='Show the Test Results'):
50
+ prediction = detect_cancer(img)
51
+ st.success(prediction)
52
+
53
+ if __name__ == '__main__':
54
+ main()