Update run.py
Browse files
run.py
CHANGED
@@ -42,9 +42,9 @@ def segment(im, interval_s=2):
|
|
42 |
imout = (logits[0, 0] - logits[0, 0].min()) / (logits[0, 0].max() - logits[0, 0].min())
|
43 |
return imout #, cnt #np.flipud(im)
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
# demo = gr.Interface(
|
50 |
# segment,
|
@@ -70,14 +70,14 @@ def segment(im, interval_s=2):
|
|
70 |
|
71 |
# image.stream(fn=segment, inputs=[image], outputs=[image])
|
72 |
|
73 |
-
demo = gr.Interface(
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
)
|
81 |
|
82 |
if __name__ == "__main__":
|
83 |
demo.launch()
|
|
|
42 |
imout = (logits[0, 0] - logits[0, 0].min()) / (logits[0, 0].max() - logits[0, 0].min())
|
43 |
return imout #, cnt #np.flipud(im)
|
44 |
|
45 |
+
with gr.Blocks() as demo:
|
46 |
+
inp = gr.Image(sources=["webcam"], streaming=True)
|
47 |
+
inp.stream(segment, inputs=inp, outputs=[gr.Image(), gr.Number()], live=True)
|
48 |
|
49 |
# demo = gr.Interface(
|
50 |
# segment,
|
|
|
70 |
|
71 |
# image.stream(fn=segment, inputs=[image], outputs=[image])
|
72 |
|
73 |
+
# demo = gr.Interface(
|
74 |
+
# fn=segment,
|
75 |
+
# inputs=[gr.Image(sources=["webcam"], streaming=True)],
|
76 |
+
# outputs=["image"],
|
77 |
+
# title="Image Inference",
|
78 |
+
# cache_examples=False,
|
79 |
+
# live=True
|
80 |
+
# )
|
81 |
|
82 |
if __name__ == "__main__":
|
83 |
demo.launch()
|