Spaces:
Runtime error
Runtime error
Changed app layout to show example next to image.
Browse files
app.py
CHANGED
@@ -8,12 +8,24 @@ from backend import Infer
|
|
8 |
|
9 |
DEBUG = False
|
10 |
|
11 |
-
|
12 |
infer = Infer(DEBUG)
|
13 |
example_image_path = ["assets/example_1.jpg", "assets/example_2.jpg", "assets/example_3.jpg"]
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
with gr.Blocks(analytics_enabled=False, title="DeepNAPSI") as demo:
|
16 |
-
outputs = []
|
17 |
with gr.Column():
|
18 |
gr.Markdown("## Welcome to the DeepNAPSI application!")
|
19 |
gr.Markdown("Upload an image of the one hand and click **Predict NAPSI** to see the output.\n" \
|
@@ -23,28 +35,27 @@ with gr.Blocks(analytics_enabled=False, title="DeepNAPSI") as demo:
|
|
23 |
with gr.Column():
|
24 |
with gr.Row():
|
25 |
image_input = gr.Image()
|
|
|
|
|
26 |
with gr.Row():
|
27 |
image_button = gr.Button("Predict NAPSI")
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
-
outputs.
|
31 |
-
outputs.
|
32 |
with gr.Column():
|
33 |
-
outputs.
|
34 |
-
outputs.
|
35 |
with gr.Column():
|
36 |
-
outputs.
|
37 |
-
outputs.
|
38 |
with gr.Column():
|
39 |
-
outputs.
|
40 |
-
outputs.
|
41 |
with gr.Column():
|
42 |
-
outputs.
|
43 |
-
outputs.
|
44 |
-
outputs.
|
45 |
-
|
46 |
-
example_images = gr.Examples(example_image_path, image_input, outputs,
|
47 |
-
fn=infer.predict, cache_examples=True)
|
48 |
image_button.click(infer.predict, inputs=image_input, outputs=outputs)
|
49 |
|
50 |
demo.launch(share=True, enable_queue=True, favicon_path="assets/favicon-32x32.png")
|
|
|
8 |
|
9 |
DEBUG = False
|
10 |
|
|
|
11 |
infer = Infer(DEBUG)
|
12 |
example_image_path = ["assets/example_1.jpg", "assets/example_2.jpg", "assets/example_3.jpg"]
|
13 |
|
14 |
+
outputs = [
|
15 |
+
gr.Image(label="Thumb"),
|
16 |
+
gr.Number(label="DeepNAPSI Thumb", precision=0),
|
17 |
+
gr.Image(label="Index"),
|
18 |
+
gr.Number(label="DeepNAPSI Index", precision=0),
|
19 |
+
gr.Image(label="Middle"),
|
20 |
+
gr.Number(label="DeepNAPSI Middle", precision=0),
|
21 |
+
gr.Image(label="Ring"),
|
22 |
+
gr.Number(label="DeepNAPSI Ring", precision=0),
|
23 |
+
gr.Image(label="Pinky"),
|
24 |
+
gr.Number(label="DeepNAPSI Pinky", precision=0),
|
25 |
+
gr.Number(label="DeepNAPSI Sum", precision=0),
|
26 |
+
]
|
27 |
+
|
28 |
with gr.Blocks(analytics_enabled=False, title="DeepNAPSI") as demo:
|
|
|
29 |
with gr.Column():
|
30 |
gr.Markdown("## Welcome to the DeepNAPSI application!")
|
31 |
gr.Markdown("Upload an image of the one hand and click **Predict NAPSI** to see the output.\n" \
|
|
|
35 |
with gr.Column():
|
36 |
with gr.Row():
|
37 |
image_input = gr.Image()
|
38 |
+
example_images = gr.Examples(example_image_path, image_input, outputs,
|
39 |
+
fn=infer.predict, cache_examples=True)
|
40 |
with gr.Row():
|
41 |
image_button = gr.Button("Predict NAPSI")
|
42 |
with gr.Row():
|
43 |
with gr.Column():
|
44 |
+
outputs[0].render()
|
45 |
+
outputs[1].render()
|
46 |
with gr.Column():
|
47 |
+
outputs[2].render()
|
48 |
+
outputs[3].render()
|
49 |
with gr.Column():
|
50 |
+
outputs[4].render()
|
51 |
+
outputs[5].render()
|
52 |
with gr.Column():
|
53 |
+
outputs[6].render()
|
54 |
+
outputs[7].render()
|
55 |
with gr.Column():
|
56 |
+
outputs[8].render()
|
57 |
+
outputs[9].render()
|
58 |
+
outputs[10].render()
|
|
|
|
|
|
|
59 |
image_button.click(infer.predict, inputs=image_input, outputs=outputs)
|
60 |
|
61 |
demo.launch(share=True, enable_queue=True, favicon_path="assets/favicon-32x32.png")
|