Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,7 +70,7 @@ def process_video(
|
|
| 70 |
if not ok:
|
| 71 |
break
|
| 72 |
rgb_frame = frame[:, :, ::-1]
|
| 73 |
-
annotated_frame
|
| 74 |
writer.write(np.asarray(annotated_frame)[:, :, ::-1])
|
| 75 |
writer.release()
|
| 76 |
cap.release()
|
|
@@ -88,18 +88,17 @@ with gr.Blocks(css_paths="style.css") as demo:
|
|
| 88 |
run_button_image = gr.Button()
|
| 89 |
with gr.Column():
|
| 90 |
output_image = gr.Image(label="Output Image")
|
| 91 |
-
output_json = gr.JSON(label="Output JSON")
|
| 92 |
gr.Examples(
|
| 93 |
examples=sorted(pathlib.Path("images").glob("*.jpg")),
|
| 94 |
inputs=input_image,
|
| 95 |
-
outputs=[output_image
|
| 96 |
fn=process_image,
|
| 97 |
)
|
| 98 |
|
| 99 |
run_button_image.click(
|
| 100 |
fn=process_image,
|
| 101 |
inputs=input_image,
|
| 102 |
-
outputs=[output_image
|
| 103 |
)
|
| 104 |
|
| 105 |
with gr.Tab("Video"):
|
|
|
|
| 70 |
if not ok:
|
| 71 |
break
|
| 72 |
rgb_frame = frame[:, :, ::-1]
|
| 73 |
+
annotated_frame = process_image(PIL.Image.fromarray(rgb_frame))
|
| 74 |
writer.write(np.asarray(annotated_frame)[:, :, ::-1])
|
| 75 |
writer.release()
|
| 76 |
cap.release()
|
|
|
|
| 88 |
run_button_image = gr.Button()
|
| 89 |
with gr.Column():
|
| 90 |
output_image = gr.Image(label="Output Image")
|
|
|
|
| 91 |
gr.Examples(
|
| 92 |
examples=sorted(pathlib.Path("images").glob("*.jpg")),
|
| 93 |
inputs=input_image,
|
| 94 |
+
outputs=[output_image],
|
| 95 |
fn=process_image,
|
| 96 |
)
|
| 97 |
|
| 98 |
run_button_image.click(
|
| 99 |
fn=process_image,
|
| 100 |
inputs=input_image,
|
| 101 |
+
outputs=[output_image],
|
| 102 |
)
|
| 103 |
|
| 104 |
with gr.Tab("Video"):
|