Spaces:
Running
Running
Add desc header, styling dropdowns
Browse files
app.py
CHANGED
@@ -63,11 +63,23 @@ css = """
|
|
63 |
object-fit: cover !important;
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
#res div h2 { color: #07ef03; }
|
67 |
"""
|
68 |
|
69 |
js = """
|
70 |
() => {
|
|
|
71 |
label = document.querySelector("#res div h2");
|
72 |
txt = label.textContent.split(",")[0]
|
73 |
if (txt === 'Access granted') {
|
@@ -78,12 +90,30 @@ js = """
|
|
78 |
}
|
79 |
}
|
80 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
def refresh():
|
82 |
image = Image.open(f'data/{file_list[0]}')
|
83 |
return image, image
|
84 |
|
85 |
-
with gr.Blocks(css=css, elem_classes=['container']) as demo:
|
86 |
-
md = gr.Markdown(value="""
|
|
|
87 |
- You can pair up images of the same or different fingerprints. The result from model will be automatically calculated.
|
88 |
- Additionally displayed confidence shows the similarity between images. The closer to 0, the more similar - more confident model
|
89 |
- Access is granted if value of confidence is below certain threshold found during model testing.""")
|
@@ -94,6 +124,8 @@ with gr.Blocks(css=css, elem_classes=['container']) as demo:
|
|
94 |
choices=file_list,
|
95 |
label='Select first image',
|
96 |
scale=1,
|
|
|
|
|
97 |
|
98 |
)
|
99 |
|
@@ -101,6 +133,7 @@ with gr.Blocks(css=css, elem_classes=['container']) as demo:
|
|
101 |
choices=file_list,
|
102 |
label='Select second image',
|
103 |
scale=1,
|
|
|
104 |
|
105 |
)
|
106 |
label = gr.Label(value='Scans of the same finger', show_label=False)
|
|
|
63 |
object-fit: cover !important;
|
64 |
}
|
65 |
|
66 |
+
.img-select div.secondary-wrap {
|
67 |
+
position: relative;
|
68 |
+
}
|
69 |
+
.img-select div.icon-wrap {
|
70 |
+
position: absolute;
|
71 |
+
pointer-events: none;
|
72 |
+
right: 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
#res div h2 { color: #07ef03; }
|
78 |
"""
|
79 |
|
80 |
js = """
|
81 |
() => {
|
82 |
+
|
83 |
label = document.querySelector("#res div h2");
|
84 |
txt = label.textContent.split(",")[0]
|
85 |
if (txt === 'Access granted') {
|
|
|
90 |
}
|
91 |
}
|
92 |
"""
|
93 |
+
|
94 |
+
dropdowns = """
|
95 |
+
() => {
|
96 |
+
input_el = document.querySelectorAll(".img-select input");
|
97 |
+
input_el[0].type = "button";
|
98 |
+
input_el[1].type = "button";
|
99 |
+
|
100 |
+
/*
|
101 |
+
svg = document.querySelectorAll(".img-select div.icon-wrap");
|
102 |
+
ul = document.querySelectorAll(".img-select ul.options);
|
103 |
+
for (let i = 0; i < input_el.length; i++){
|
104 |
+
input_el[i].addEventListener("click", () => {
|
105 |
+
svg[i].style.transform = "rotate(180deg)";
|
106 |
+
})
|
107 |
+
}*/
|
108 |
+
}
|
109 |
+
"""
|
110 |
def refresh():
|
111 |
image = Image.open(f'data/{file_list[0]}')
|
112 |
return image, image
|
113 |
|
114 |
+
with gr.Blocks(css=css, js=dropdowns, elem_classes=['container']) as demo:
|
115 |
+
md = gr.Markdown(value="""# Follow the steps
|
116 |
+
- To check model performance choose first and second image from available examples.
|
117 |
- You can pair up images of the same or different fingerprints. The result from model will be automatically calculated.
|
118 |
- Additionally displayed confidence shows the similarity between images. The closer to 0, the more similar - more confident model
|
119 |
- Access is granted if value of confidence is below certain threshold found during model testing.""")
|
|
|
124 |
choices=file_list,
|
125 |
label='Select first image',
|
126 |
scale=1,
|
127 |
+
elem_classes='img-select',
|
128 |
+
|
129 |
|
130 |
)
|
131 |
|
|
|
133 |
choices=file_list,
|
134 |
label='Select second image',
|
135 |
scale=1,
|
136 |
+
elem_classes='img-select',
|
137 |
|
138 |
)
|
139 |
label = gr.Label(value='Scans of the same finger', show_label=False)
|