Spaces:
Sleeping
Sleeping
Files Uploaded
Browse files- app.py +29 -0
- my_cnn_model.h5 +3 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from tensorflow.keras.models import load_model
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
model=load_model('my_cnn_model.h5')
|
| 8 |
+
|
| 9 |
+
def process_image(img):
|
| 10 |
+
img=img.resize((170,170))
|
| 11 |
+
img=np.array(img)
|
| 12 |
+
img=img/255.0
|
| 13 |
+
img=np.expand_dims(img,axis=0) #resmi ortaya almasini sagladik
|
| 14 |
+
return img
|
| 15 |
+
|
| 16 |
+
st.title('Image Classification of Cancer Image :eye:')
|
| 17 |
+
st.write('Select an image, and the model predicts cancer or not')
|
| 18 |
+
|
| 19 |
+
file=st.file_uploader('Bir resim sec',type=['jpg','jpeg','png'])
|
| 20 |
+
|
| 21 |
+
if file is not None:
|
| 22 |
+
img=Image.open(file)
|
| 23 |
+
st.image(img,caption='yuklenen resim')
|
| 24 |
+
image=process_image(img)
|
| 25 |
+
predictions=model.predict(image)
|
| 26 |
+
predicted_class=np.argmax(predictions)
|
| 27 |
+
|
| 28 |
+
class_names =['Not Cancer','Cancer']
|
| 29 |
+
st.write(class_names[predicted_class])
|
my_cnn_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3013a2600e79245007e510685a1bf7ebdb7ca7a2a3073552c31765e3acd7f2c7
|
| 3 |
+
size 165525592
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|