Spaces:
Sleeping
Sleeping
Add dropdowns, label default values
Browse files
app.py
CHANGED
@@ -52,22 +52,27 @@ def predict(input1, input2, label=None):
|
|
52 |
return img1_PIL, img2_PIL, decision, label
|
53 |
|
54 |
#%%
|
|
|
|
|
|
|
55 |
with gr.Blocks() as demo:
|
56 |
drop1 = gr.Dropdown(
|
|
|
57 |
choices=file_list,
|
58 |
label='First image',
|
59 |
scale=0
|
60 |
)
|
61 |
drop2 = gr.Dropdown(
|
|
|
62 |
choices=file_list,
|
63 |
label='Second image',
|
64 |
scale=0
|
65 |
)
|
66 |
with gr.Row():
|
67 |
-
img1 = gr.Image(value=
|
68 |
-
img2 = gr.Image(value=
|
69 |
-
label = gr.Label(label='0 means images represent the same fingerprint')
|
70 |
-
output = gr.Label(value=predict(*examples[0])[2], label='Prediction')
|
71 |
|
72 |
drop1.change(fn=predict, inputs=[drop1, drop2], outputs=[img1, img2, output, label])
|
73 |
drop2.change(fn=predict, inputs=[drop1, drop2], outputs=[img1, img2, output, label])
|
|
|
52 |
return img1_PIL, img2_PIL, decision, label
|
53 |
|
54 |
#%%
|
55 |
+
|
56 |
+
img_PIL = Image.open(f'data/{file_list[0]}')
|
57 |
+
|
58 |
with gr.Blocks() as demo:
|
59 |
drop1 = gr.Dropdown(
|
60 |
+
value=file_list[0],
|
61 |
choices=file_list,
|
62 |
label='First image',
|
63 |
scale=0
|
64 |
)
|
65 |
drop2 = gr.Dropdown(
|
66 |
+
value=file_list[0],
|
67 |
choices=file_list,
|
68 |
label='Second image',
|
69 |
scale=0
|
70 |
)
|
71 |
with gr.Row():
|
72 |
+
img1 = gr.Image(value=img_PIL, height=153, width=136, interactive=False, scale=0, label='image1')
|
73 |
+
img2 = gr.Image(value=img_PIL, height=153, width=136, interactive=False, scale=0, label='image2')
|
74 |
+
label = gr.Label(value=0, label='0 means images represent the same fingerprint')
|
75 |
+
output = gr.Label(value=predict(*examples[0])[2], label='Prediction, the closer to 0, the more similar')
|
76 |
|
77 |
drop1.change(fn=predict, inputs=[drop1, drop2], outputs=[img1, img2, output, label])
|
78 |
drop2.change(fn=predict, inputs=[drop1, drop2], outputs=[img1, img2, output, label])
|