Spaces:
Runtime error
Runtime error
Update app-backup.py
Browse files- app-backup.py +109 -34
app-backup.py
CHANGED
|
@@ -232,8 +232,8 @@ def analyze_image_for_robot(
|
|
| 232 |
prompt: str,
|
| 233 |
task_type: str = "general",
|
| 234 |
use_web_search: bool = False,
|
| 235 |
-
enable_thinking: bool =
|
| 236 |
-
max_new_tokens: int =
|
| 237 |
) -> str:
|
| 238 |
"""๋ก๋ด ์์
์ ์ํ ์ด๋ฏธ์ง ๋ถ์"""
|
| 239 |
global model, processor
|
|
@@ -247,23 +247,25 @@ def analyze_image_for_robot(
|
|
| 247 |
if isinstance(image, np.ndarray):
|
| 248 |
image = Image.fromarray(image).convert('RGB')
|
| 249 |
|
| 250 |
-
# ํ์คํฌ๋ณ ์์คํ
ํ๋กฌํํธ ๊ตฌ์ฑ
|
| 251 |
system_prompts = {
|
| 252 |
-
"general": "๋น์ ์ ๋ก๋ด ์๊ฐ ์์คํ
์
๋๋ค.
|
| 253 |
-
"planning": """๋น์ ์ ๋ก๋ด ์์
|
| 254 |
-
|
| 255 |
-
ํ์: Step_1: xxx
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
"
|
| 259 |
-
"
|
|
|
|
|
|
|
| 260 |
}
|
| 261 |
|
| 262 |
system_prompt = system_prompts.get(task_type, system_prompts["general"])
|
| 263 |
|
| 264 |
-
# Chain-of-Thought ์ถ๊ฐ
|
| 265 |
if enable_thinking:
|
| 266 |
-
system_prompt += "\n\n์ถ๋ก ๊ณผ์ ์ <thinking></thinking> ํ๊ทธ ์์
|
| 267 |
|
| 268 |
# ์น ๊ฒ์ ์ํ
|
| 269 |
combined_system = system_prompt
|
|
@@ -468,6 +470,15 @@ css = """
|
|
| 468 |
padding: 10px;
|
| 469 |
background: #f8f9fa;
|
| 470 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
"""
|
| 472 |
|
| 473 |
with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as demo:
|
|
@@ -489,7 +500,7 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 489 |
<li>๐ค ๋ก๋ด ํ์ง์ ๋ถ์ (Affordance)</li>
|
| 490 |
<li>๐ค๏ธ ๊ฒฝ๋ก ๊ณํ (Trajectory Planning)</li>
|
| 491 |
<li>๐ ์ค์๊ฐ ์น ๊ฒ์ ํตํฉ</li>
|
| 492 |
-
<li
|
| 493 |
</ul>
|
| 494 |
</div>
|
| 495 |
""")
|
|
@@ -508,6 +519,11 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 508 |
height=350
|
| 509 |
)
|
| 510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
# ์บก์ฒ๋ ์ด๋ฏธ์ง ํ์
|
| 512 |
captured_image = gr.Image(
|
| 513 |
label="์บก์ฒ๋ ์ด๋ฏธ์ง",
|
|
@@ -518,9 +534,16 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 518 |
# ๋ก๋ด ์์
๋ฒํผ๋ค
|
| 519 |
gr.Markdown("### ๐ฏ ๋ก๋ด ์์
์ ํ")
|
| 520 |
with gr.Row():
|
| 521 |
-
capture_btn = gr.Button("๐ธ ์บก์ฒ", variant="primary", elem_classes="task-button")
|
| 522 |
clear_capture_btn = gr.Button("๐๏ธ ์ด๊ธฐํ", elem_classes="task-button")
|
| 523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 524 |
with gr.Row():
|
| 525 |
planning_btn = gr.Button("๐ ์์
๊ณํ", elem_classes="task-button")
|
| 526 |
grounding_btn = gr.Button("๐ ๊ฐ์ฒด ์์น", elem_classes="task-button")
|
|
@@ -551,16 +574,16 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 551 |
|
| 552 |
enable_thinking = gr.Checkbox(
|
| 553 |
label="๐ค ์ถ๋ก ๊ณผ์ ํ์",
|
| 554 |
-
value=
|
| 555 |
info="Chain-of-Thought ์ถ๋ก ๊ณผ์ ์ ๋ณด์ฌ์ค๋๋ค"
|
| 556 |
)
|
| 557 |
|
| 558 |
max_tokens = gr.Slider(
|
| 559 |
label="์ต๋ ํ ํฐ ์",
|
| 560 |
-
minimum=
|
| 561 |
maximum=4096,
|
| 562 |
-
value=
|
| 563 |
-
step=
|
| 564 |
)
|
| 565 |
|
| 566 |
gr.Markdown("### ๐ ๋ถ์ ๊ฒฐ๊ณผ")
|
|
@@ -576,8 +599,8 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 576 |
'<div class="status-box" style="background:#d4edda; color:#155724;">๐ฎ ์์คํ
์ค๋น ์๋ฃ</div>'
|
| 577 |
)
|
| 578 |
|
| 579 |
-
# ๋ฌธ์ ๋ถ์ ํญ
|
| 580 |
-
with gr.Tab("๐ ๋ฌธ์ ๋ถ์"):
|
| 581 |
with gr.Row():
|
| 582 |
with gr.Column():
|
| 583 |
doc_files = gr.File(
|
|
@@ -609,6 +632,7 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 609 |
|
| 610 |
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
| 611 |
webcam_state = gr.State(None)
|
|
|
|
| 612 |
|
| 613 |
def capture_webcam(frame):
|
| 614 |
"""์น์บ ํ๋ ์ ์บก์ฒ"""
|
|
@@ -636,29 +660,57 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 636 |
max_new_tokens=tokens
|
| 637 |
)
|
| 638 |
|
| 639 |
-
# ๊ฒฐ๊ณผ ํฌ๋งทํ
|
| 640 |
timestamp = time.strftime("%H:%M:%S")
|
| 641 |
task_names = {
|
| 642 |
"planning": "์์
๊ณํ",
|
| 643 |
-
"grounding": "๊ฐ์ฒด ์์น
|
| 644 |
-
"affordance": "ํ์ง์
|
| 645 |
"trajectory": "๊ฒฝ๋ก ๊ณํ"
|
| 646 |
}
|
| 647 |
|
| 648 |
-
formatted_result = f"""๐ค
|
| 649 |
-
|
| 650 |
-
๐ธ **์์
**: {prompt}
|
| 651 |
|
| 652 |
-
|
| 653 |
-
{result}
|
| 654 |
-
|
| 655 |
-
โฐ ๋ถ์ ์๊ฐ: {timestamp}
|
| 656 |
-
๐ฏ ๋ชจ๋ธ: {model_name}
|
| 657 |
-
๐ง ํ์คํฌ: {task_type}"""
|
| 658 |
|
| 659 |
complete_status = '<div class="status-box" style="background:#d4edda; color:#155724;">โ
๋ถ์ ์๋ฃ!</div>'
|
| 660 |
return formatted_result, complete_status
|
| 661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 662 |
# ์น์บ ์คํธ๋ฆฌ๋ฐ
|
| 663 |
webcam.stream(
|
| 664 |
fn=lambda x: x,
|
|
@@ -666,7 +718,7 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 666 |
outputs=[webcam_state]
|
| 667 |
)
|
| 668 |
|
| 669 |
-
# ์บก์ฒ ๋ฒํผ
|
| 670 |
capture_btn.click(
|
| 671 |
fn=capture_webcam,
|
| 672 |
inputs=[webcam_state],
|
|
@@ -720,6 +772,29 @@ with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as dem
|
|
| 720 |
outputs=[doc_result]
|
| 721 |
)
|
| 722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 723 |
# ์ด๊ธฐ ๋ชจ๋ธ ๋ก๋
|
| 724 |
def initial_load():
|
| 725 |
load_model()
|
|
|
|
| 232 |
prompt: str,
|
| 233 |
task_type: str = "general",
|
| 234 |
use_web_search: bool = False,
|
| 235 |
+
enable_thinking: bool = False, # ๊ธฐ๋ณธ๊ฐ False๋ก ๋ณ๊ฒฝ
|
| 236 |
+
max_new_tokens: int = 250 # ๊ธฐ๋ณธ๊ฐ 250์ผ๋ก ๋ณ๊ฒฝ
|
| 237 |
) -> str:
|
| 238 |
"""๋ก๋ด ์์
์ ์ํ ์ด๋ฏธ์ง ๋ถ์"""
|
| 239 |
global model, processor
|
|
|
|
| 247 |
if isinstance(image, np.ndarray):
|
| 248 |
image = Image.fromarray(image).convert('RGB')
|
| 249 |
|
| 250 |
+
# ํ์คํฌ๋ณ ์์คํ
ํ๋กฌํํธ ๊ตฌ์ฑ (๋ ๊ฐ๊ฒฐํ๊ฒ)
|
| 251 |
system_prompts = {
|
| 252 |
+
"general": "๋น์ ์ ๋ก๋ด ์๊ฐ ์์คํ
์
๋๋ค. ํต์ฌ ๋ด์ฉ๋ง ๊ฐ๊ฒฐํ๊ฒ ์ค๋ช
ํ์ธ์.",
|
| 253 |
+
"planning": """๋น์ ์ ๋ก๋ด ์์
๊ณํ AI์
๋๋ค.
|
| 254 |
+
์ฃผ์ ๋จ๊ณ๋ง ๊ฐ๊ฒฐํ๊ฒ ์์ฑํ์ธ์.
|
| 255 |
+
ํ์: Step_1: xxx
|
| 256 |
+
Step_2: xxx
|
| 257 |
+
Step_n: xxx""",
|
| 258 |
+
"grounding": "๋น์ ์ ๊ฐ์ฒด ์์น ์์คํ
์
๋๋ค. ๊ฐ์ฒด ์์น๋ฅผ [x1, y1, x2, y2]๋ก ๋ฐํํ์ธ์.",
|
| 259 |
+
"affordance": "๋น์ ์ ํ์ง์ ๋ถ์ AI์
๋๋ค. ํ์ง ์์ญ์ [x1, y1, x2, y2]๋ก ๋ฐํํ์ธ์.",
|
| 260 |
+
"trajectory": "๋น์ ์ ๊ฒฝ๋ก ๊ณํ AI์
๋๋ค. ๊ฒฝ๋ก๋ฅผ [(x1,y1), (x2,y2), ...]๋ก ์ ์ํ์ธ์.",
|
| 261 |
+
"pointing": "๋น์ ์ ์ง์ ์ง์ ์์คํ
์
๋๋ค. ์์น๋ฅผ [(x1,y1), (x2,y2), ...]๋ก ๋ฐํํ์ธ์."
|
| 262 |
}
|
| 263 |
|
| 264 |
system_prompt = system_prompts.get(task_type, system_prompts["general"])
|
| 265 |
|
| 266 |
+
# Chain-of-Thought ์ถ๊ฐ (์ ํ์ )
|
| 267 |
if enable_thinking:
|
| 268 |
+
system_prompt += "\n\n์ถ๋ก ๊ณผ์ ์ <thinking></thinking> ํ๊ทธ ์์ ์์ฑ ํ ์ต์ข
๋ต๋ณ์ ์ ์ํ์ธ์."
|
| 269 |
|
| 270 |
# ์น ๊ฒ์ ์ํ
|
| 271 |
combined_system = system_prompt
|
|
|
|
| 470 |
padding: 10px;
|
| 471 |
background: #f8f9fa;
|
| 472 |
}
|
| 473 |
+
.auto-capture-status {
|
| 474 |
+
text-align: center;
|
| 475 |
+
padding: 5px;
|
| 476 |
+
border-radius: 5px;
|
| 477 |
+
margin: 5px 0;
|
| 478 |
+
font-weight: bold;
|
| 479 |
+
background: #e8f5e9;
|
| 480 |
+
color: #2e7d32;
|
| 481 |
+
}
|
| 482 |
"""
|
| 483 |
|
| 484 |
with gr.Blocks(title="๐ค ๋ก๋ด ์๊ฐ ์์คํ
(Gemma3-4B)", css=css) as demo:
|
|
|
|
| 500 |
<li>๐ค ๋ก๋ด ํ์ง์ ๋ถ์ (Affordance)</li>
|
| 501 |
<li>๐ค๏ธ ๊ฒฝ๋ก ๊ณํ (Trajectory Planning)</li>
|
| 502 |
<li>๐ ์ค์๊ฐ ์น ๊ฒ์ ํตํฉ</li>
|
| 503 |
+
<li>๐ 10์ด๋ง๋ค ์๋ ์บก์ฒ ๋ฐ ๋ถ์</li>
|
| 504 |
</ul>
|
| 505 |
</div>
|
| 506 |
""")
|
|
|
|
| 519 |
height=350
|
| 520 |
)
|
| 521 |
|
| 522 |
+
# ์๋ ์บก์ฒ ์ํ ํ์
|
| 523 |
+
auto_capture_status = gr.HTML(
|
| 524 |
+
'<div class="auto-capture-status">๐ ์๋ ์บก์ฒ: ๋๊ธฐ ์ค</div>'
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
# ์บก์ฒ๋ ์ด๋ฏธ์ง ํ์
|
| 528 |
captured_image = gr.Image(
|
| 529 |
label="์บก์ฒ๋ ์ด๋ฏธ์ง",
|
|
|
|
| 534 |
# ๋ก๋ด ์์
๋ฒํผ๋ค
|
| 535 |
gr.Markdown("### ๐ฏ ๋ก๋ด ์์
์ ํ")
|
| 536 |
with gr.Row():
|
| 537 |
+
capture_btn = gr.Button("๐ธ ์๋ ์บก์ฒ", variant="primary", elem_classes="task-button")
|
| 538 |
clear_capture_btn = gr.Button("๐๏ธ ์ด๊ธฐํ", elem_classes="task-button")
|
| 539 |
|
| 540 |
+
with gr.Row():
|
| 541 |
+
auto_capture_toggle = gr.Checkbox(
|
| 542 |
+
label="๐ ์๋ ์บก์ฒ ํ์ฑํ (10์ด๋ง๋ค)",
|
| 543 |
+
value=False,
|
| 544 |
+
info="ํ์ฑํ ์ 10์ด๋ง๋ค ์๋์ผ๋ก ์บก์ฒ ๋ฐ ๋ถ์"
|
| 545 |
+
)
|
| 546 |
+
|
| 547 |
with gr.Row():
|
| 548 |
planning_btn = gr.Button("๐ ์์
๊ณํ", elem_classes="task-button")
|
| 549 |
grounding_btn = gr.Button("๐ ๊ฐ์ฒด ์์น", elem_classes="task-button")
|
|
|
|
| 574 |
|
| 575 |
enable_thinking = gr.Checkbox(
|
| 576 |
label="๐ค ์ถ๋ก ๊ณผ์ ํ์",
|
| 577 |
+
value=False, # ๊ธฐ๋ณธ๊ฐ False๋ก ๋ณ๊ฒฝ
|
| 578 |
info="Chain-of-Thought ์ถ๋ก ๊ณผ์ ์ ๋ณด์ฌ์ค๋๋ค"
|
| 579 |
)
|
| 580 |
|
| 581 |
max_tokens = gr.Slider(
|
| 582 |
label="์ต๋ ํ ํฐ ์",
|
| 583 |
+
minimum=100,
|
| 584 |
maximum=4096,
|
| 585 |
+
value=250, # ๊ธฐ๋ณธ๊ฐ 250์ผ๋ก ๋ณ๊ฒฝ
|
| 586 |
+
step=50
|
| 587 |
)
|
| 588 |
|
| 589 |
gr.Markdown("### ๐ ๋ถ์ ๊ฒฐ๊ณผ")
|
|
|
|
| 599 |
'<div class="status-box" style="background:#d4edda; color:#155724;">๐ฎ ์์คํ
์ค๋น ์๋ฃ</div>'
|
| 600 |
)
|
| 601 |
|
| 602 |
+
# ๋ฌธ์ ๋ถ์ ํญ (์จ๊น ์ฒ๋ฆฌ)
|
| 603 |
+
with gr.Tab("๐ ๋ฌธ์ ๋ถ์", visible=False): # visible=False๋ก ์จ๊น
|
| 604 |
with gr.Row():
|
| 605 |
with gr.Column():
|
| 606 |
doc_files = gr.File(
|
|
|
|
| 632 |
|
| 633 |
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
| 634 |
webcam_state = gr.State(None)
|
| 635 |
+
auto_capture_state = gr.State({"enabled": False, "timer": None})
|
| 636 |
|
| 637 |
def capture_webcam(frame):
|
| 638 |
"""์น์บ ํ๋ ์ ์บก์ฒ"""
|
|
|
|
| 660 |
max_new_tokens=tokens
|
| 661 |
)
|
| 662 |
|
| 663 |
+
# ๊ฒฐ๊ณผ ํฌ๋งทํ
(๋ ๊ฐ๊ฒฐํ๊ฒ)
|
| 664 |
timestamp = time.strftime("%H:%M:%S")
|
| 665 |
task_names = {
|
| 666 |
"planning": "์์
๊ณํ",
|
| 667 |
+
"grounding": "๊ฐ์ฒด ์์น",
|
| 668 |
+
"affordance": "ํ์ง์ ",
|
| 669 |
"trajectory": "๊ฒฝ๋ก ๊ณํ"
|
| 670 |
}
|
| 671 |
|
| 672 |
+
formatted_result = f"""๐ค {task_names.get(task_type, '๋ถ์')} ๊ฒฐ๊ณผ ({timestamp}):
|
|
|
|
|
|
|
| 673 |
|
| 674 |
+
{result}"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 675 |
|
| 676 |
complete_status = '<div class="status-box" style="background:#d4edda; color:#155724;">โ
๋ถ์ ์๋ฃ!</div>'
|
| 677 |
return formatted_result, complete_status
|
| 678 |
|
| 679 |
+
# ์๋ ์บก์ฒ ๋ฐ ๋ถ์ ํจ์
|
| 680 |
+
def auto_capture_and_analyze(webcam_frame, task_prompt, use_search, thinking, tokens, auto_state):
|
| 681 |
+
"""์๋ ์บก์ฒ ๋ฐ ๋ถ์"""
|
| 682 |
+
if webcam_frame is None:
|
| 683 |
+
return (
|
| 684 |
+
None,
|
| 685 |
+
"์๋ ์บก์ฒ ๋๊ธฐ ์ค...",
|
| 686 |
+
'<div class="status-box" style="background:#fff3cd; color:#856404;">โณ ์น์บ ๋๊ธฐ ์ค</div>',
|
| 687 |
+
'<div class="auto-capture-status">๐ ์๋ ์บก์ฒ: ์น์บ ๋๊ธฐ ์ค</div>'
|
| 688 |
+
)
|
| 689 |
+
|
| 690 |
+
# ์บก์ฒ ์ํ
|
| 691 |
+
timestamp = time.strftime("%H:%M:%S")
|
| 692 |
+
|
| 693 |
+
# ์ด๋ฏธ์ง ๋ถ์ (์์
๊ณํ ๋ชจ๋๋ก)
|
| 694 |
+
result = analyze_image_for_robot(
|
| 695 |
+
image=webcam_frame,
|
| 696 |
+
prompt=task_prompt,
|
| 697 |
+
task_type="planning",
|
| 698 |
+
use_web_search=use_search,
|
| 699 |
+
enable_thinking=thinking,
|
| 700 |
+
max_new_tokens=tokens
|
| 701 |
+
)
|
| 702 |
+
|
| 703 |
+
formatted_result = f"""๐ ์๋ ๋ถ์ ({timestamp}):
|
| 704 |
+
|
| 705 |
+
{result}"""
|
| 706 |
+
|
| 707 |
+
return (
|
| 708 |
+
webcam_frame,
|
| 709 |
+
formatted_result,
|
| 710 |
+
'<div class="status-box" style="background:#d4edda; color:#155724;">โ
์๋ ๋ถ์ ์๋ฃ</div>',
|
| 711 |
+
f'<div class="auto-capture-status">๐ ์๋ ์บก์ฒ: ๋ง์ง๋ง ๋ถ์ {timestamp}</div>'
|
| 712 |
+
)
|
| 713 |
+
|
| 714 |
# ์น์บ ์คํธ๋ฆฌ๋ฐ
|
| 715 |
webcam.stream(
|
| 716 |
fn=lambda x: x,
|
|
|
|
| 718 |
outputs=[webcam_state]
|
| 719 |
)
|
| 720 |
|
| 721 |
+
# ์๋ ์บก์ฒ ๋ฒํผ
|
| 722 |
capture_btn.click(
|
| 723 |
fn=capture_webcam,
|
| 724 |
inputs=[webcam_state],
|
|
|
|
| 772 |
outputs=[doc_result]
|
| 773 |
)
|
| 774 |
|
| 775 |
+
# ์๋ ์บก์ฒ ํ์ด๋จธ (10์ด๋ง๋ค)
|
| 776 |
+
timer = gr.Timer(10.0, active=False) # 10์ด ํ์ด๋จธ, ์ด๊ธฐ์๋ ๋นํ์ฑํ
|
| 777 |
+
|
| 778 |
+
# ์๋ ์บก์ฒ ํ ๊ธ ์ด๋ฒคํธ
|
| 779 |
+
def toggle_auto_capture(enabled):
|
| 780 |
+
if enabled:
|
| 781 |
+
return gr.Timer(10.0, active=True), '<div class="auto-capture-status">๐ ์๋ ์บก์ฒ: ํ์ฑํ๋จ (10์ด๋ง๋ค)</div>'
|
| 782 |
+
else:
|
| 783 |
+
return gr.Timer(active=False), '<div class="auto-capture-status">๐ ์๋ ์บก์ฒ: ๋นํ์ฑํ๋จ</div>'
|
| 784 |
+
|
| 785 |
+
auto_capture_toggle.change(
|
| 786 |
+
fn=toggle_auto_capture,
|
| 787 |
+
inputs=[auto_capture_toggle],
|
| 788 |
+
outputs=[timer, auto_capture_status]
|
| 789 |
+
)
|
| 790 |
+
|
| 791 |
+
# ํ์ด๋จธ ํฑ ์ด๋ฒคํธ
|
| 792 |
+
timer.tick(
|
| 793 |
+
fn=auto_capture_and_analyze,
|
| 794 |
+
inputs=[webcam_state, task_prompt, use_web_search, enable_thinking, max_tokens, auto_capture_state],
|
| 795 |
+
outputs=[captured_image, result_output, status_display, auto_capture_status]
|
| 796 |
+
)
|
| 797 |
+
|
| 798 |
# ์ด๊ธฐ ๋ชจ๋ธ ๋ก๋
|
| 799 |
def initial_load():
|
| 800 |
load_model()
|