alperugurcan commited on
Commit
51813b7
·
verified ·
1 Parent(s): 66def10

Upload untitled3.py

Browse files
Files changed (1) hide show
  1. untitled3.py +41 -0
untitled3.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """Untitled3.ipynb
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1OS-UaGZUegFfwJmaELsau9--kGmq_8wz
8
+ """
9
+
10
+ !pip install streamlit
11
+ import streamlit as st
12
+ from tensorflow.keras.models import load_model
13
+ from PIL import Image
14
+ import numpy as np
15
+ import cv2
16
+
17
+ # Eğitilmiş modeli yükle
18
+ model = load_model('skin_cancer_model.h5')
19
+
20
+ def process_image(image):
21
+ img=np.array(image)
22
+ img=cv2.resize(img,(224,224))
23
+ img=img/255.0
24
+ img=np.expand_dims(img,axis=0)
25
+ return img
26
+
27
+ st.title('Traffic Sign Image Classifier')
28
+ st.write('Upload a image and model will predict which traffic sign it is.')
29
+
30
+ file = st.file_uploader('Choose a image...', type=['jpg', 'jpeg', 'png'])
31
+ if file is not None:
32
+ img = Image.open(file)
33
+ st.image(img, caption='Uploaded Image')
34
+
35
+ image = process_image(img)
36
+ prediction = model.predict(image)
37
+ predicted_class = np.argmax(prediction)
38
+
39
+ class_names = ['Not Cancer', 'Cancer']
40
+ st.write(class_names[predicted_class])
41
+