aminaB9 commited on
Commit
36955d6
·
1 Parent(s): 1d2239a

Added image processing

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -167,14 +167,16 @@ with gr.Blocks() as demo:
167
  with gr.Row():
168
  gr.Markdown("### Step 1: Upload or select a reference facial image for enrollment.")
169
  with gr.Row():
 
170
  with gr.Column():
171
- image_input_enroll = gr.Image(label="Upload a reference facial image.", type="pil", sources="upload")
172
- image_input_enroll.change(fn=crop_face_to_112x112, inputs=image_input_enroll, outputs=image_input_enroll)
173
  with gr.Column():
174
  example_gallery = gr.Gallery(value=example_images, columns=3)
 
175
  with gr.Column():
176
- image_output_enroll = gr.Image(label="Reference facial image", sources="upload")
177
- image_input_enroll.change(fn=display_image, inputs=image_input_enroll, outputs=image_output_enroll)
178
 
179
  with gr.Row():
180
  gr.Markdown("### Step 2: Generate reference embedding.")
@@ -244,14 +246,17 @@ with gr.Blocks() as demo:
244
  with gr.Row():
245
  gr.Markdown("### Step 1: Upload or select a probe facial image for authentication.")
246
  with gr.Row():
 
 
247
  with gr.Column():
248
- image_input_auth = gr.Image(label="Upload a facial image.", type="pil", sources="upload")
249
- image_input_auth.change(fn=crop_face_to_112x112, inputs=image_input_auth, outputs=image_input_auth)
250
  with gr.Column():
251
  example_gallery = gr.Gallery(value=example_images_auth, columns=3)
 
252
  with gr.Column():
253
- image_output_auth = gr.Image(label="Probe facial image", sources="upload")
254
- image_input_auth.change(fn=display_image, inputs=image_input_auth, outputs=image_output_auth)
255
 
256
  with gr.Row():
257
  gr.Markdown("### Step 2: Generate probe facial embedding.")
 
167
  with gr.Row():
168
  gr.Markdown("### Step 1: Upload or select a reference facial image for enrollment.")
169
  with gr.Row():
170
+ image_input_enroll = gr.Image(type="pil", visible=False)
171
  with gr.Column():
172
+ image_upload_enroll = gr.Image(label="Upload a reference facial image.", type="pil", sources="upload")
173
+ image_upload_enroll.change(fn=crop_face_to_112x112, inputs=image_upload_enroll, outputs=image_input_enroll)
174
  with gr.Column():
175
  example_gallery = gr.Gallery(value=example_images, columns=3)
176
+ example_gallery.select(fn=get_selected_image, inputs=None, outputs=image_input_enroll)
177
  with gr.Column():
178
+ selectedImage = gr.Image(type="pil", label="Reference facial image", interactive=False)
179
+ image_input_enroll.change(fn=lambda img: img, inputs=image_input_enroll, outputs=selectedImage)
180
 
181
  with gr.Row():
182
  gr.Markdown("### Step 2: Generate reference embedding.")
 
246
  with gr.Row():
247
  gr.Markdown("### Step 1: Upload or select a probe facial image for authentication.")
248
  with gr.Row():
249
+ selectedImagePath_auth = gr.State()
250
+ image_input_auth = gr.Image(type="pil", visible=False)
251
  with gr.Column():
252
+ image_upload_auth = gr.Image(label="Upload a facial image.", type="pil", sources="upload")
253
+ image_upload_auth.change(fn=crop_face_to_112x112, inputs=image_upload_auth, outputs=image_input_auth)
254
  with gr.Column():
255
  example_gallery = gr.Gallery(value=example_images_auth, columns=3)
256
+ example_gallery.select(fn=get_selected_image_auth, inputs=None, outputs=image_input_auth)
257
  with gr.Column():
258
+ selectedImage = gr.Image(type="pil", label="Probe facial image", interactive=False)
259
+ image_input_auth.change(fn=lambda img: img, inputs=image_input_auth, outputs=selectedImage)
260
 
261
  with gr.Row():
262
  gr.Markdown("### Step 2: Generate probe facial embedding.")