JaredBailey commited on
Commit
faf7691
·
verified ·
1 Parent(s): 23523d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -114,13 +114,16 @@ if st.session_state.image is not None:
114
 
115
  # model
116
  model = YOLO("/home/user/app/models/head_model/best.pt") # load
117
- pred = model.predict([st.session_state.image]) # predict
118
 
119
 
120
  _, col_1, col_2, _ = st.columns([1, 4, 4, 1], gap="medium")
121
  with col_1:
122
  st.write('small image 1 here')
123
- st.image(pred[0])
 
 
 
124
  with col_2:
125
  st.image(st.session_state.image, use_column_width=True)
126
 
 
114
 
115
  # model
116
  model = YOLO("/home/user/app/models/head_model/best.pt") # load
117
+ results = model.predict([st.session_state.image]) # predict
118
 
119
 
120
  _, col_1, col_2, _ = st.columns([1, 4, 4, 1], gap="medium")
121
  with col_1:
122
  st.write('small image 1 here')
123
+ # Plot predicted image
124
+ im_bgr = results[0].plot() # BGR-order numpy array
125
+ im_rgb = Image.fromarray(im_bgr[..., ::-1]) # RGB-order PIL image
126
+ st.image(im_rgb)
127
  with col_2:
128
  st.image(st.session_state.image, use_column_width=True)
129