tomas-gajarsky commited on
Commit
b5d23b1
1 Parent(s): 58754c3

Add Action Unit result to the app

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -48,6 +48,7 @@ def inference(path_image: str) -> Tuple:
48
  pil_image = torchvision.transforms.functional.to_pil_image(response.img)
49
 
50
  fer_dict_str = str({face.indx: face.preds["fer"].label for face in response.faces})
 
51
  deepfake_dict_str = str({face.indx: face.preds["deepfake"].label for face in response.faces})
52
  response_str = str(response)
53
 
@@ -56,12 +57,12 @@ def inference(path_image: str) -> Tuple:
56
 
57
  os.remove(path_image)
58
 
59
- out_tuple = (pil_image, fer_dict_str, deepfake_dict_str, sim_dict_str_embed, sim_dict_str_verify, response_str)
60
  return out_tuple
61
 
62
 
63
  title = "Face Analysis"
64
- description = "Demo of facetorch, a face analysis Python library that implements open-source pre-trained neural networks for face detection, representation learning, verification, expression recognition, deepfake detection, and 3D alignment. Try selecting one of the example images or upload your own. Feel free to duplicate this space and run it faster on a GPU instance. This work would not be possible without the researchers and engineers who trained the models (sources and credits can be found in the facetorch repository)."
65
  article = "<p style='text-align: center'><a href='https://github.com/tomas-gajarsky/facetorch' style='text-align:center' target='_blank'>facetorch GitHub repository</a></p>"
66
 
67
  demo=gr.Interface(
@@ -69,6 +70,7 @@ demo=gr.Interface(
69
  [gr.Image(label="Input", type="filepath")],
70
  [gr.Image(type="pil", label="Face Detection and 3D Landmarks"),
71
  gr.Textbox(label="Facial Expression Recognition"),
 
72
  gr.Textbox(label="DeepFake Detection"),
73
  gr.Textbox(label="Cosine similarity of Face Representation Embeddings"),
74
  gr.Textbox(label="Cosine similarity of Face Verification Embeddings"),
 
48
  pil_image = torchvision.transforms.functional.to_pil_image(response.img)
49
 
50
  fer_dict_str = str({face.indx: face.preds["fer"].label for face in response.faces})
51
+ au_dict_str = str({face.indx: face.preds["au"].other["multi"] for face in response.faces})
52
  deepfake_dict_str = str({face.indx: face.preds["deepfake"].label for face in response.faces})
53
  response_str = str(response)
54
 
 
57
 
58
  os.remove(path_image)
59
 
60
+ out_tuple = (pil_image, fer_dict_str, au_dict_str, deepfake_dict_str, sim_dict_str_embed, sim_dict_str_verify, response_str)
61
  return out_tuple
62
 
63
 
64
  title = "Face Analysis"
65
+ description = "Demo of facetorch, a face analysis Python library that implements open-source pre-trained neural networks for face detection, representation learning, verification, expression recognition, action unit detection, deepfake detection, and 3D alignment. Try selecting one of the example images or upload your own. Feel free to duplicate this space and run it faster on a GPU instance. This work would not be possible without the researchers and engineers who trained the models (sources and credits can be found in the facetorch repository)."
66
  article = "<p style='text-align: center'><a href='https://github.com/tomas-gajarsky/facetorch' style='text-align:center' target='_blank'>facetorch GitHub repository</a></p>"
67
 
68
  demo=gr.Interface(
 
70
  [gr.Image(label="Input", type="filepath")],
71
  [gr.Image(type="pil", label="Face Detection and 3D Landmarks"),
72
  gr.Textbox(label="Facial Expression Recognition"),
73
+ gr.Textbox(label="Facial Action Unit Detection"),
74
  gr.Textbox(label="DeepFake Detection"),
75
  gr.Textbox(label="Cosine similarity of Face Representation Embeddings"),
76
  gr.Textbox(label="Cosine similarity of Face Verification Embeddings"),