foot-detection / app.py
tonyassi's picture
Update app.py
84ce883 verified
raw
history blame
609 Bytes
import gradio as gr
from FootDetection import FootDetection
# Initialize model (first run will auto-download weights)
foot_detection = FootDetection("cpu") # "cuda" for GPU or "mps" for App
def detect(img, threshold):
results = foot_detection.detect(img, threshold=threshold)
img_with_boxes = foot_detection.draw_boxes(img)
return img_with_boxes
demo = gr.Interface(fn=detect,
inputs=[gr.Image(label='Input', type='pil'), gr.Slider(label='Threshold', minimum=0.0, maximum=1.0, value=0.3)],
outputs=gr.Image(label='Result', type='pil'))
demo.launch()