Update app.py
Browse files
app.py
CHANGED
@@ -526,6 +526,7 @@ def log_information(result_gallery):
|
|
526 |
if result_gallery is not None:
|
527 |
for i, result in enumerate(result_gallery):
|
528 |
print(result[0])
|
|
|
529 |
|
530 |
def on_select_result(result_slider, result_gallery, evt: gr.SelectData):
|
531 |
print('on_select_result')
|
@@ -536,24 +537,19 @@ def on_select_result(result_slider, result_gallery, evt: gr.SelectData):
|
|
536 |
'''
|
537 |
def on_select_result(result_slider, result_gallery, evt: gr.SelectData):
|
538 |
print('on_select_result')
|
539 |
-
|
540 |
-
|
541 |
-
print(
|
542 |
-
|
543 |
-
|
544 |
-
# evt.index が整数型か確認し、安全に値を返す
|
545 |
-
if isinstance(evt.index, int):
|
546 |
-
return [result_slider[0], result_gallery[evt.index][0]]
|
547 |
-
else:
|
548 |
-
print("Invalid event index type")
|
549 |
-
return [None, None] # 型が正しくない場合のデフォルト値
|
550 |
else:
|
551 |
-
print("
|
552 |
-
return [None, None] #
|
553 |
-
|
554 |
-
print(
|
555 |
-
return [None, None] #
|
556 |
-
|
|
|
557 |
|
558 |
|
559 |
title_html = """
|
|
|
526 |
if result_gallery is not None:
|
527 |
for i, result in enumerate(result_gallery):
|
528 |
print(result[0])
|
529 |
+
'''
|
530 |
|
531 |
def on_select_result(result_slider, result_gallery, evt: gr.SelectData):
|
532 |
print('on_select_result')
|
|
|
537 |
'''
|
538 |
def on_select_result(result_slider, result_gallery, evt: gr.SelectData):
|
539 |
print('on_select_result')
|
540 |
+
if result_gallery is not None:
|
541 |
+
for i, result in enumerate(result_gallery):
|
542 |
+
print(result[0])
|
543 |
+
if 0 <= evt.index < len(result_gallery): # indexが有効な範囲内かチェック
|
544 |
+
return [result_slider[0], result_gallery[evt.index][0]]
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
else:
|
546 |
+
print("Invalid event index value")
|
547 |
+
return [None, None] # indexが無効な場合のデフォルト値
|
548 |
+
else:
|
549 |
+
print("result_gallery is None")
|
550 |
+
return [None, None] # result_galleryがNoneの場合のデフォルト値
|
551 |
+
|
552 |
+
|
553 |
|
554 |
|
555 |
title_html = """
|