EcoSmart / app.py
rosebe's picture
Update app.py
1f86d79
raw
history blame
945 Bytes
# import gradio as gr
# import torch
# model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
# # Define the face detector function
# def detect_faces(image):
# # Loading in yolov5s - you can switch to larger models such as yolov5m or yolov5l, or smaller such as yolov5n
# results = model(image)
# return results.render()[0]
# # Create a Gradio interface
# iface = gr.Interface(fn=detect_faces, inputs="image", outputs="image")
# # Launch the interface
# iface.launch(debug=True)
import gradio as gr
def snap(video):
results = model(image)
return [results.render()[0]]
# def detect_faces(image):
# # # Loading in yolov5s - you can switch to larger models such as yolov5m or yolov5l, or smaller such as yolov5n
# results = model(image)
# return results.render()[0]
demo = gr.Interface(
snap,
gr.Video(source="webcam"),
"image",
)
if __name__ == "__main__":
demo.launch()