drkareemkamal commited on
Commit
c167a16
·
verified ·
1 Parent(s): 31e248a

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -39
app.py DELETED
@@ -1,39 +0,0 @@
1
- import streamlit as st
2
- import tensorflow as tf
3
- from PIL import Image
4
-
5
- model = tf.keras.models.load_model('Brain_tumor/')
6
- st.write('Model is loaded successfully')
7
-
8
- TEMP_DIR = 'temp'
9
-
10
- class_names = ['glioma', 'meningioma', 'notumor', 'pituitary']
11
-
12
- def load_and_prep_imgg(filename ,img_shape=229, scale=True):
13
-
14
- img = tf.io.read_file(filename)
15
-
16
- img = tf.io.decode_image(img)
17
-
18
- img = tf.image.resize(img,size=[img_shape,img_shape])
19
-
20
- if scale :
21
- return img/255
22
- else :
23
- return img
24
-
25
- st.title('Brain Tumor Classidfication Predition using Xception ImageNet ')
26
-
27
- uploaded_file = st.sidebar.file_uploader('Upload your Image', type=['jpg'])
28
-
29
- if uploaded_file:
30
-
31
- file_path = os.path.join(TEMP_DIR, uploaded_file.name)
32
- img = load_and_prep_imgg(file_path,scale=True)
33
- imgg = Image.open(file_path)
34
- st.image(img,caption ="Predicted brain tumor is : {pred_class} with probs : {pred_img:max():.2f}" )
35
-
36
- pred_img = model.predict(tf.expand_dims(img,axis=0))
37
- pred_class = class_names[pred_img.argmax()]
38
- st.write(f"Predicted brain tumor is : {pred_class} with probs : {pred_img:max():.2f}")
39
-