Spaces:
Sleeping
Sleeping
File size: 874 Bytes
64ec997 c817722 0324d3b c817722 64ec997 c817722 0324d3b c817722 0324d3b c817722 52adba0 c817722 0324d3b c817722 52adba0 f195a6f 52adba0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import spaces
import gradio as gr
from detect_faces import detect_faces
@spaces.GPU
def process_image(input_image, box_margin):
if input_image is None:
return []
output_images = detect_faces(input_image, box_margin=box_margin)
return output_images
from_file = gr.Interface(
fn=process_image,
inputs=[gr.Image(type="filepath"), gr.Slider(0, 40)],
outputs=gr.Gallery(height="100%", label="Faces"),
allow_flagging="never",
live=True,
)
from_camera = gr.Interface(
fn=process_image,
inputs=[
gr.Image(sources=["webcam"], streaming=True, type="filepath"),
gr.Slider(0, 40),
],
outputs=gr.Gallery(height="100%", label="Faces"),
allow_flagging="never",
live=True,
api_name="predict_faces",
)
tabs = gr.TabbedInterface([from_file, from_camera], ["From File", "From Camera"])
tabs.launch()
|