JaredBailey commited on
Commit
51624ae
·
verified ·
1 Parent(s): 1f181d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -25,6 +25,7 @@ import torch
25
  from ultralytics import YOLO
26
  from src.tiles import *
27
  from src.image_transform import *
 
28
 
29
 
30
 
@@ -243,17 +244,20 @@ if st.session_state.screen == 2:
243
  for idx, pred in enumerate(st.session_state.results):
244
  #extract detected character names and their confidence scores
245
  st.session_state.detected_characters = {}
246
- for x, y, w, h, cls_id, conf in pred:
247
- name = class_names[int(cls_id)] # Convert class ID to character name
248
- if name in st.session_state.detected_characters:
249
- if conf >= st.session_state.confidence:
250
- st.session_state.detected_characters[name].append(idx)
 
 
 
251
 
252
  # display locations
253
- st.session_state.locations = ""
254
- for name, idx in st.session_state.detected_characters.items():
255
- st.session_state.locations += f" {name} tiles: {str(idx)}, )"
256
- st.write(st.session_state.locations)
257
 
258
  # plot predicted image
259
  st.markdown(f"<h4 style='text-align: center; color: black;'>Image Tile {str(st.session_state.image_counter + 1)}</h4>", unsafe_allow_html=True)
 
25
  from ultralytics import YOLO
26
  from src.tiles import *
27
  from src.image_transform import *
28
+ from time import sleep
29
 
30
 
31
 
 
244
  for idx, pred in enumerate(st.session_state.results):
245
  #extract detected character names and their confidence scores
246
  st.session_state.detected_characters = {}
247
+ st.write(str(idx) + str(pred))
248
+ sleep(1)
249
+ # for cls_id in pred:
250
+ # name = class_names[int(cls_id)] # Convert class ID to character name
251
+
252
+ # if name in st.session_state.detected_characters:
253
+ # if conf >= st.session_state.confidence:
254
+ # st.session_state.detected_characters[name].append(idx)
255
 
256
  # display locations
257
+ # st.session_state.locations = ""
258
+ # for name, idx in st.session_state.detected_characters.items():
259
+ # st.session_state.locations += f" {name} tiles: {str(idx)}, )"
260
+ # st.write(st.session_state.locations)
261
 
262
  # plot predicted image
263
  st.markdown(f"<h4 style='text-align: center; color: black;'>Image Tile {str(st.session_state.image_counter + 1)}</h4>", unsafe_allow_html=True)