mamechin's picture
Upload app.py
4809d91
raw
history blame
No virus
874 Bytes
from hubconf import custom
model = custom(path_or_model='best.pt') # custom example
# model = create(name='yolov7', pretrained=True, channels=3, classes=80, autoshape=True) # pretrained example
# Verify inference
import numpy as np
from PIL import Image
import gradio as gr
# imgs = [np.zeros((640, 480, 3))]
# imgs = 'inference/images/meal.jpg'
# results = model(imgs) # batched inference
# results.print()
# results.save()
def predict(input_image):
"""
Predict model output
"""
results = model(input_image)
output_image = results.render()[0]
price = "0"
# Return the output image and price
return [output_image, price]
# return [input_image, price]
# gr.Interface(inputs=["image"],outputs=["image"],fn=lambda img:model(img).render()[0]).launch()
gr.Interface(inputs=["image"], outputs=["image", "text"], fn=predict).launch()