|
import gradio as gr |
|
import torch |
|
import numpy as np |
|
from PIL import Image |
|
|
|
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', _verbose=False) |
|
|
|
def gradio_wrapper(img): |
|
global model |
|
results = model(img) |
|
return results.render()[0] |
|
|
|
image = gr.Image(source="webcam", streaming=True) |
|
|
|
|
|
|
|
demo = gr.Interface( |
|
gradio_wrapper, |
|
image, |
|
'image', |
|
live=True, |
|
title="CiclopeIA", |
|
description="Aplicación basada en el proyecto CiclopeIA de Saturdays AI. Identifica el valor de los billetes de Euro." |
|
) |
|
|
|
demo.launch() |