aiqcamp commited on
Commit
fe841a7
ยท
verified ยท
1 Parent(s): de04166

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -15
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
- webcam_instruction = gr.Textbox(
333
- label="Instruction",
334
- placeholder="Enter instruction here...",
335
- scale=4
336
- )
337
  with gr.Row():
338
- start_button = gr.Button("Start Processing")
339
- stop_button = gr.Button("Stop Processing")
 
 
 
 
 
340
  with gr.Column():
341
  webcam_output = gr.Textbox(label="Response")
342
- status_text = gr.Textbox(label="Status", value="Ready")
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: webcam_vision.processor.stop() if hasattr(webcam_vision, 'processor') else "Not running",
352
  outputs=[status_text]
353
  )
354
 
 
 
 
 
 
 
 
355
 
356
-
357
- demo.queue().launch(show_api=False, show_error=True)
 
 
 
 
 
 
 
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
+ )