Update run.py
Browse files
run.py
CHANGED
@@ -45,12 +45,30 @@ def segment(im, interval_s=2):
|
|
45 |
# inp = gr.Image(sources=["webcam"], streaming=True)
|
46 |
# inp.stream(segment, inputs=inp, outputs=[gr.Image(), gr.Number()])
|
47 |
|
48 |
-
demo = gr.Interface(
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
)
|
53 |
|
54 |
-
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
demo.launch()
|
|
|
45 |
# inp = gr.Image(sources=["webcam"], streaming=True)
|
46 |
# inp.stream(segment, inputs=inp, outputs=[gr.Image(), gr.Number()])
|
47 |
|
48 |
+
# demo = gr.Interface(
|
49 |
+
# segment,
|
50 |
+
# [gr.Image(sources=["webcam"], streaming=True)],
|
51 |
+
# ["image"],
|
52 |
+
# )
|
53 |
|
54 |
+
# if __name__ == "__main__":
|
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"n)
|
69 |
+
image.stream(
|
70 |
+
fn=segment, inputs=[image], outputs=[image], time_limit=10
|
71 |
+
)
|
72 |
+
|
73 |
+
if __name__ == "__main__":
|
74 |
demo.launch()
|