elifsara commited on
Commit
25318ec
1 Parent(s): a4f6ae5

Upload 2 files

Browse files
Files changed (2) hide show
  1. app2.py +29 -0
  2. requierements.txt +2 -0
app2.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
+ model=load_model('my_fish_model.h5')
7
+
8
+ def process_image(img):
9
+ img=img.resize((170,170)) #boyutunu 170*170 pixel yaptık
10
+ img=np.array(img)
11
+ img=img/255.0 #Normalize ettik
12
+ img=np.expand_dims(img,axis=0)
13
+ return img
14
+
15
+ st.title('Large Scale Fish :fish:')
16
+ st.write('Resim seç ve hangi balik türü olduğunu tahmin etsin')
17
+
18
+ file=st.file_uploader('Bir Resim Sec', type=['jpg','jpeg','png'])
19
+
20
+ if file is not None:
21
+ img=Image.open(file)
22
+ st.image(img,caption='yuklenen resim')
23
+ image=process_image(img)
24
+ prediction=model.predict(image)
25
+ predicted_class=np.argmax(prediction)
26
+
27
+ class_names=['Black Sea Sprat','Gilt-Head Bream','Hourse Mackerel','Red Mullet',
28
+ 'Red Sea Bream','Sea Bass','Shrimp','Striped Red Mullet','Trout']
29
+ st.write(class_names[predicted_class])
requierements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ tensorflow