Beasto commited on
Commit
f99fef7
·
1 Parent(s): 2e0c133

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -2
app.py CHANGED
@@ -3,6 +3,8 @@ from streamlit_option_menu import option_menu
3
  import json
4
  from streamlit_lottie import st_lottie
5
  from PIL import Image
 
 
6
 
7
  page_bg_img = '''
8
  <style>
@@ -14,7 +16,20 @@ body {
14
  '''
15
 
16
  st.markdown(page_bg_img, unsafe_allow_html=True)
17
-
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  def lottiemaker(path):
19
  with open(path) as f:
20
  return json.load(f)
@@ -24,6 +39,7 @@ def loadimg(path):
24
  img = img.resize((150,150))
25
  return img
26
 
 
27
  selected = option_menu(
28
  menu_title=None,
29
  options = ['About me','Tools and Experience','Projects','Contacts'],
@@ -144,7 +160,22 @@ elif selected == 'Projects':
144
 
145
  options = {'Cyclegan':1, 'Pix2Pix':2, 'DCGAN':3,'YOLO Segmentation':4,'Unet':5,'Machine Learning Text classifier':6}
146
  selected_option = st.selectbox('Select an option', options)
147
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  st.write('You selected:', selected_option)
149
  else:
150
  st.write(selected)
 
3
  import json
4
  from streamlit_lottie import st_lottie
5
  from PIL import Image
6
+ from tensorflow.keras.models import load_model
7
+ import numpy as np
8
 
9
  page_bg_img = '''
10
  <style>
 
16
  '''
17
 
18
  st.markdown(page_bg_img, unsafe_allow_html=True)
19
+ def img_prep(paths):
20
+ out = []
21
+ for i in paths:
22
+ img = Image.open(i)
23
+ img = img.resize((256,256))
24
+ img = ((np.asarray(img))/127.5)-1
25
+ out.append(img)
26
+
27
+ def model_out(img,model_path):
28
+ img = np.expand_dims(img,0)
29
+ model = load_model(model_path)
30
+ pred = model.predict(img)
31
+ return pred[0]
32
+
33
  def lottiemaker(path):
34
  with open(path) as f:
35
  return json.load(f)
 
39
  img = img.resize((150,150))
40
  return img
41
 
42
+
43
  selected = option_menu(
44
  menu_title=None,
45
  options = ['About me','Tools and Experience','Projects','Contacts'],
 
160
 
161
  options = {'Cyclegan':1, 'Pix2Pix':2, 'DCGAN':3,'YOLO Segmentation':4,'Unet':5,'Machine Learning Text classifier':6}
162
  selected_option = st.selectbox('Select an option', options)
163
+
164
+ if selected_option == 'Unet':
165
+ imgs = img_prep(['unet1','unet2'])
166
+ col1,col2 = st.columns(2)
167
+ with col1:
168
+ st.image(imgs[0],use_column_width=False)
169
+ with col2:
170
+ st.image(imgs[1],use_column_width=False)
171
+
172
+ img_options = {'img1':1, 'img2':2}
173
+ img_selected_option = st.selectbox('Select an option', options)
174
+ if img_selected_option == 'img1':
175
+ st.image(imgs[0],use_column_width=False)
176
+ if img_selected_option == 'img2':
177
+ st.image(imgs[1],use_column_width=False)
178
+
179
  st.write('You selected:', selected_option)
180
  else:
181
  st.write(selected)