Spaces:
Runtime error
Runtime error
eeshawn
commited on
Commit
·
635c7ff
1
Parent(s):
26a86b9
update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,8 @@ yolo_model.overrides['max_det'] = 10
|
|
10 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
11 |
yolo_model.to(device)
|
12 |
|
|
|
|
|
13 |
def seal_detection(
|
14 |
image,
|
15 |
conf_threshold,
|
@@ -70,6 +72,16 @@ with gr.Blocks() as demo:
|
|
70 |
outputs = gr.Image(type="filepath", label="Output Image", interactive=False)
|
71 |
flag = gr.Button("Flag")
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
gr.Markdown(
|
74 |
"""
|
75 |
<p style="text-align:center">
|
@@ -81,8 +93,8 @@ with gr.Blocks() as demo:
|
|
81 |
|
82 |
clear_form.click(fn=clear, inputs=None, outputs=[image[0], slider[0], outputs], show_progress=False)
|
83 |
submit.click(fn=seal_detection, inputs=[image[0], slider[0]], outputs=outputs)
|
84 |
-
flag.click(lambda *args: callback.flag([image, slider, outputs]), inputs=[image[0], slider[0], outputs], outputs=None, preprocess=False)
|
85 |
|
86 |
if __name__ == "__main__":
|
87 |
demo.queue(api_open=False, max_size=10)
|
88 |
-
demo.launch()
|
|
|
10 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
11 |
yolo_model.to(device)
|
12 |
|
13 |
+
print(os.path.dirname(__file__))
|
14 |
+
|
15 |
def seal_detection(
|
16 |
image,
|
17 |
conf_threshold,
|
|
|
72 |
outputs = gr.Image(type="filepath", label="Output Image", interactive=False)
|
73 |
flag = gr.Button("Flag")
|
74 |
|
75 |
+
with gr.Row():
|
76 |
+
gr.Examples(
|
77 |
+
examples=[os.path.join(os.path.dirname(__file__), "/assets/Naruto_Hand_Seals_by_Megan.gif")],
|
78 |
+
inputs=image,
|
79 |
+
outputs=outputs,
|
80 |
+
fn=seal_detection,
|
81 |
+
run_on_click=True,
|
82 |
+
cache_examples=True
|
83 |
+
)
|
84 |
+
|
85 |
gr.Markdown(
|
86 |
"""
|
87 |
<p style="text-align:center">
|
|
|
93 |
|
94 |
clear_form.click(fn=clear, inputs=None, outputs=[image[0], slider[0], outputs], show_progress=False)
|
95 |
submit.click(fn=seal_detection, inputs=[image[0], slider[0]], outputs=outputs)
|
96 |
+
flag.click(lambda *args: callback.flag([image[0], slider[0], outputs]), inputs=[image[0], slider[0], outputs], outputs=None, preprocess=False)
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
demo.queue(api_open=False, max_size=10)
|
100 |
+
demo.launch()
|