danu9327 commited on
Commit
cc10707
ยท
1 Parent(s): 1a7158c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -99,11 +99,15 @@ def on_mouseover(mouse_info):
99
  highlight_segmentation(x, y)
100
 
101
  def highlight_segmentation(x, y):
102
- # ๋งˆ์šฐ์Šค ์œ„์น˜์— ๋Œ€ํ•œ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
103
- seg_value = seg.numpy()[y, x]
104
-
105
- # ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ์ •๋ณด ์ถœ๋ ฅ
106
- print(f"Mouse over position: ({x}, {y}), Segmentation value: {seg_value}")
 
 
 
 
107
 
108
  def sepia(input_img):
109
  input_img = Image.fromarray(input_img)
 
99
  highlight_segmentation(x, y)
100
 
101
  def highlight_segmentation(x, y):
102
+ # ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜ ์ •๋ณด๊ฐ€ None์ด ์•„๋‹Œ ๊ฒฝ์šฐ์—๋งŒ ์ถœ๋ ฅ
103
+ if seg is not None:
104
+ try:
105
+ seg_value = seg.numpy()[y, x]
106
+ print(f"Mouse over position: ({x}, {y}), Segmentation value: {seg_value}")
107
+ except IndexError:
108
+ print(f"Invalid mouse position: ({x}, {y}), Segmentation value cannot be retrieved.")
109
+ else:
110
+ print("Segmentation information is not available.")
111
 
112
  def sepia(input_img):
113
  input_img = Image.fromarray(input_img)