Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -325,33 +325,51 @@ with gr.Blocks(analytics_enabled=False) as demo:
|
|
325 |
outputs = [vid_output_res, output_video]
|
326 |
)
|
327 |
|
328 |
-
|
329 |
with gr.Tab("Webcam"):
|
330 |
with gr.Row():
|
331 |
with gr.Column():
|
332 |
-
|
333 |
-
|
334 |
-
placeholder="Enter instruction here...",
|
335 |
-
scale=4
|
336 |
-
)
|
337 |
with gr.Row():
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
340 |
with gr.Column():
|
341 |
webcam_output = gr.Textbox(label="Response")
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
344 |
start_button.click(
|
345 |
-
fn=webcam_vision,
|
346 |
inputs=[webcam_instruction],
|
347 |
outputs=[webcam_output]
|
348 |
)
|
349 |
-
|
|
|
350 |
stop_button.click(
|
351 |
-
fn=lambda:
|
352 |
outputs=[status_text]
|
353 |
)
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
-
|
357 |
-
demo.queue().launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
outputs = [vid_output_res, output_video]
|
326 |
)
|
327 |
|
|
|
328 |
with gr.Tab("Webcam"):
|
329 |
with gr.Row():
|
330 |
with gr.Column():
|
331 |
+
# ์น์บ ์ปดํฌ๋ํธ
|
332 |
+
webcam_input = gr.Video(source="webcam", label="Webcam Input")
|
|
|
|
|
|
|
333 |
with gr.Row():
|
334 |
+
webcam_instruction = gr.Textbox(
|
335 |
+
label="Instruction",
|
336 |
+
placeholder="Enter instruction here...",
|
337 |
+
scale=4
|
338 |
+
)
|
339 |
+
start_button = gr.Button("Start", scale=1)
|
340 |
+
stop_button = gr.Button("Stop", scale=1)
|
341 |
with gr.Column():
|
342 |
webcam_output = gr.Textbox(label="Response")
|
343 |
+
processed_view = gr.Image(label="Processed View")
|
344 |
+
|
345 |
+
status_text = gr.Textbox(label="Status", value="Ready")
|
346 |
+
|
347 |
+
# ์น์บ ์ฒ๋ฆฌ ์์
|
348 |
start_button.click(
|
349 |
+
fn=lambda x: webcam_vision(x),
|
350 |
inputs=[webcam_instruction],
|
351 |
outputs=[webcam_output]
|
352 |
)
|
353 |
+
|
354 |
+
# ์น์บ ์ฒ๋ฆฌ ์ค์ง
|
355 |
stop_button.click(
|
356 |
+
fn=lambda: "Stopped" if hasattr(webcam_vision, 'processor') and webcam_vision.processor.stop() else "Not running",
|
357 |
outputs=[status_text]
|
358 |
)
|
359 |
|
360 |
+
# ์ค์๊ฐ ์
๋ฐ์ดํธ๋ฅผ ์ํ ์ฃผ๊ธฐ์ ๊ฐฑ์
|
361 |
+
demo.load(
|
362 |
+
fn=lambda: None,
|
363 |
+
inputs=None,
|
364 |
+
outputs=[processed_view],
|
365 |
+
every=1 # 1์ด๋ง๋ค ๊ฐฑ์
|
366 |
+
)
|
367 |
|
368 |
+
# ์น์บ ์ก์ธ์ค ๊ถํ์ ์์ฒญํ๊ณ ๋๋ฒ๊ทธ ๋ชจ๋๋ก ์คํ
|
369 |
+
demo.queue().launch(
|
370 |
+
show_api=False,
|
371 |
+
show_error=True,
|
372 |
+
enable_queue=True,
|
373 |
+
debug=True,
|
374 |
+
share=True # ์ธ๋ถ ์ ๊ทผ ํ์ฉ
|
375 |
+
)
|