Spaces:
Runtime error
Runtime error
federico
commited on
Commit
β’
927a203
1
Parent(s):
6e7ba4c
refactored main
Browse files
app.py
CHANGED
@@ -93,33 +93,6 @@ def demo_play(img, laeo=True, rgb=False):
|
|
93 |
return img
|
94 |
|
95 |
|
96 |
-
demo_webcam = gr.Interface(
|
97 |
-
fn=demo_play,
|
98 |
-
inputs=[gr.Image(source="webcam"), # with no streaming-> acquire images
|
99 |
-
gr.Checkbox(value=True, label="LAEO", info="Compute and display LAEO"),
|
100 |
-
gr.Checkbox(value=False, label="rgb", info="Display output on W/B image"),
|
101 |
-
],
|
102 |
-
outputs="image",
|
103 |
-
live=True,
|
104 |
-
title="Head Pose Estimation and LAEO",
|
105 |
-
description="This is a demo developed by Federico Figari T. at MaLGa Lab, University of Genoa, Italy. You can choose to have only the Head Pose Estimation or also the LAEO computation (more than 1 person should be in the image). You need to take a picture and the algorithm will calculate the Head Pose and will be showed as an arrow on your face. LAEO, instead is showed colouring the arrow in green.",
|
106 |
-
# examples=EXAMPLES,
|
107 |
-
)
|
108 |
-
|
109 |
-
demo_upload = gr.Interface(
|
110 |
-
fn=demo_play,
|
111 |
-
inputs=[gr.Image(source="upload",), # with no streaming-> acquire images
|
112 |
-
gr.Checkbox(value=True, label="LAEO", info="Compute and display LAEO"),
|
113 |
-
gr.Checkbox(value=False, label="rgb", info="Display output on W/B image"),
|
114 |
-
],
|
115 |
-
outputs="image",
|
116 |
-
live=True,
|
117 |
-
title="Head Pose Estimation and LAEO",
|
118 |
-
description="This is a demo developed by Federico Figari T. at MaLGa Lab, University of Genoa, Italy. You can choose to have only the Head Pose Estimation or also the LAEO computation (more than 1 person should be in the image). You need to upload an image and the algorithm will calculate the Head Pose and will be showed as an arrow on your face. LAEO, instead is showed colouring the arrow in green.",
|
119 |
-
examples=[["LAEO_demo_data/examples/1.jpg"], ["LAEO_demo_data/examples/20.jpg"]]
|
120 |
-
)
|
121 |
-
|
122 |
-
demo_tabbed = gr.TabbedInterface([demo_webcam, demo_upload], ["Demo from webcam", "Demo from upload"])
|
123 |
|
124 |
if __name__=='__main__':
|
125 |
if not os.path.exists("LAEO_demo_data"):
|
@@ -145,4 +118,32 @@ if __name__=='__main__':
|
|
145 |
|
146 |
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
demo_tabbed.launch()
|
|
|
93 |
return img
|
94 |
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
if __name__=='__main__':
|
98 |
if not os.path.exists("LAEO_demo_data"):
|
|
|
118 |
|
119 |
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
|
120 |
|
121 |
+
demo_webcam = gr.Interface(
|
122 |
+
fn=demo_play,
|
123 |
+
inputs=[gr.Image(source="webcam"), # with no streaming-> acquire images
|
124 |
+
gr.Checkbox(value=True, label="LAEO", info="Compute and display LAEO"),
|
125 |
+
gr.Checkbox(value=False, label="rgb", info="Display output on W/B image"),
|
126 |
+
],
|
127 |
+
outputs="image",
|
128 |
+
live=True,
|
129 |
+
title="Head Pose Estimation and LAEO",
|
130 |
+
description="This is a demo developed by Federico Figari T. at MaLGa Lab, University of Genoa, Italy. You can choose to have only the Head Pose Estimation or also the LAEO computation (more than 1 person should be in the image). You need to take a picture and the algorithm will calculate the Head Pose and will be showed as an arrow on your face. LAEO, instead is showed colouring the arrow in green.",
|
131 |
+
# examples=EXAMPLES,
|
132 |
+
)
|
133 |
+
|
134 |
+
demo_upload = gr.Interface(
|
135 |
+
fn=demo_play,
|
136 |
+
inputs=[gr.Image(source="upload", ), # with no streaming-> acquire images
|
137 |
+
gr.Checkbox(value=True, label="LAEO", info="Compute and display LAEO"),
|
138 |
+
gr.Checkbox(value=False, label="rgb", info="Display output on W/B image"),
|
139 |
+
],
|
140 |
+
outputs="image",
|
141 |
+
live=True,
|
142 |
+
title="Head Pose Estimation and LAEO",
|
143 |
+
description="This is a demo developed by Federico Figari T. at MaLGa Lab, University of Genoa, Italy. You can choose to have only the Head Pose Estimation or also the LAEO computation (more than 1 person should be in the image). You need to upload an image and the algorithm will calculate the Head Pose and will be showed as an arrow on your face. LAEO, instead is showed colouring the arrow in green.",
|
144 |
+
examples=[["LAEO_demo_data/examples/1.jpg"], ["LAEO_demo_data/examples/20.jpg"]]
|
145 |
+
)
|
146 |
+
|
147 |
+
demo_tabbed = gr.TabbedInterface([demo_webcam, demo_upload], ["Demo from webcam", "Demo from upload"])
|
148 |
+
|
149 |
demo_tabbed.launch()
|