metehanayhan commited on
Commit
47e4734
·
verified ·
1 Parent(s): d15f8d2

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +34 -0
  2. my_cnn_model.h5 +3 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Load the model
7
+ model = load_model('my_cnn_model.h5')
8
+
9
+ #yeni gelen resmi modelin girdi boyutuna uygun hale getirelim
10
+ def process_image(image):
11
+ image = image.resize((170,170))
12
+ image = np.array(image)
13
+ image = image / 255.0
14
+ image = np.expand_dims(image, axis=0) # burada modelin beklediği gibi bir girdi oluşturduk
15
+ return image
16
+
17
+
18
+ st.title("Skin Cancer Classification - Metehan Ayhan")
19
+ st.write("This is a simple image classification web app to predict the type of skin cancer.")
20
+ st.write("Please upload a skin image for the prediction.")
21
+
22
+ file = st.file_uploader("Please upload an image file", type=["jpg", "png", "jpeg"])
23
+
24
+ if file is None:
25
+ st.text("You haven't uploaded an image file")
26
+ else:
27
+ image = Image.open(file) # resmi aç
28
+ st.image(image, use_column_width=True, caption='Image:') # resmi gösterelim
29
+ predictions = model.predict(process_image(image))
30
+ predicted_class = np.argmax(predictions) # en yüksek olasılığa sahip sınıfı al
31
+
32
+ class_names = ['Cancer', 'Not Cancer']
33
+
34
+ st.write(class_names[predicted_class], "with", round(100*np.max(predictions), 2), "% probability")
my_cnn_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ea7242edd7b03e5943667efad8cd57477780e50fb51b22dc957cde9d2779c9a
3
+ size 165525592
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ tensorflow