noamholz commited on
Commit
2858e47
·
verified ·
1 Parent(s): 8262081

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +18 -10
run.py CHANGED
@@ -55,19 +55,27 @@ def segment(im, interval_s=2):
55
 
56
  # demo.launch()
57
 
58
- from gradio_webrtc import WebRTC
59
 
60
- css = """.my-group {max-width: 600px !important; max-height: 600px !important;}
61
- .my-column {display: flex !important; justify-content: center !important; align-items: center !important;}"""
62
 
63
- with gr.Blocks(css=css) as demo:
64
- gr.HTML(
65
- )
66
- with gr.Column(elem_classes=["my-column"]):
67
- with gr.Group(elem_classes=["my-group"]):
68
- image = WebRTC(label="Stream")
69
 
70
- image.stream(fn=segment, inputs=[image], outputs=[image])
 
 
 
 
 
 
 
 
71
 
72
  if __name__ == "__main__":
73
  demo.launch()
 
55
 
56
  # demo.launch()
57
 
58
+ # from gradio_webrtc import WebRTC
59
 
60
+ # css = """.my-group {max-width: 600px !important; max-height: 600px !important;}
61
+ # .my-column {display: flex !important; justify-content: center !important; align-items: center !important;}"""
62
 
63
+ # with gr.Blocks(css=css) as demo:
64
+ # gr.HTML(
65
+ # )
66
+ # with gr.Column(elem_classes=["my-column"]):
67
+ # with gr.Group(elem_classes=["my-group"]):
68
+ # image = WebRTC(label="Stream")
69
 
70
+ # image.stream(fn=segment, inputs=[image], outputs=[image])
71
+
72
+ interface_image = gr.Interface(
73
+ fn=segment,
74
+ inputs=[gr.Image(sources=["webcam"], streaming=True)],
75
+ outputs=["image"],
76
+ title="Image Inference",
77
+ cache_examples=False,
78
+ )
79
 
80
  if __name__ == "__main__":
81
  demo.launch()