Spaces:
Running
Running
Commit
·
8cdef7f
1
Parent(s):
941fa10
Refactor inference function in app.py to remove image file path from output and update UI components accordingly.
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def inference(image_fp):
|
|
57 |
"""Run inference on image and return annotated image."""
|
58 |
image = imread(image_fp)
|
59 |
results = model(image)
|
60 |
-
return results.draw(image)
|
61 |
|
62 |
|
63 |
def flag_img_input(
|
@@ -98,14 +98,13 @@ with gr.Blocks(theme=theme, css=css, title="SEA.AI Vision Demo") as demo:
|
|
98 |
submit = gr.Button("Submit", variant="primary")
|
99 |
with gr.Column():
|
100 |
img_output = gr.Image(label="output", interactive=False)
|
101 |
-
img_filepath = gr.Textbox(label="image_filepath", visible=False)
|
102 |
flag = gr.Button(FLAG_TXT, visible=False)
|
103 |
notice = gr.Markdown(value=NOTICE, visible=False)
|
104 |
|
105 |
examples = gr.Examples(
|
106 |
examples=glob.glob("examples/*.jpg"),
|
107 |
inputs=img_input,
|
108 |
-
outputs=
|
109 |
fn=inference,
|
110 |
cache_examples=True,
|
111 |
)
|
@@ -118,7 +117,7 @@ with gr.Blocks(theme=theme, css=css, title="SEA.AI Vision Demo") as demo:
|
|
118 |
submit.click(check_image, [img_input], None, show_api=False).success(
|
119 |
inference,
|
120 |
[img_input],
|
121 |
-
|
122 |
api_name="inference",
|
123 |
)
|
124 |
|
|
|
57 |
"""Run inference on image and return annotated image."""
|
58 |
image = imread(image_fp)
|
59 |
results = model(image)
|
60 |
+
return results.draw(image)
|
61 |
|
62 |
|
63 |
def flag_img_input(
|
|
|
98 |
submit = gr.Button("Submit", variant="primary")
|
99 |
with gr.Column():
|
100 |
img_output = gr.Image(label="output", interactive=False)
|
|
|
101 |
flag = gr.Button(FLAG_TXT, visible=False)
|
102 |
notice = gr.Markdown(value=NOTICE, visible=False)
|
103 |
|
104 |
examples = gr.Examples(
|
105 |
examples=glob.glob("examples/*.jpg"),
|
106 |
inputs=img_input,
|
107 |
+
outputs=img_output,
|
108 |
fn=inference,
|
109 |
cache_examples=True,
|
110 |
)
|
|
|
117 |
submit.click(check_image, [img_input], None, show_api=False).success(
|
118 |
inference,
|
119 |
[img_input],
|
120 |
+
img_output,
|
121 |
api_name="inference",
|
122 |
)
|
123 |
|