opticar / app.py
drewinspirit's picture
Upload folder using huggingface_hub
9a197e0 verified
Raw
History Blame Contribute Delete
510 Bytes
import json
import gradio as gr
from tensorflow.keras.models import load_model
from helpers import detect_image
model = load_model("yolo_model.keras")
anchors = json.load(open("anchors.json"))
labels = json.load(open("labels.json"))
def predict(image):
return detect_image(image, model, anchors, labels)
demo = gr.Interface(
fn=predict,
inputs=gr.Image(type="pil", label="Upload an image"),
outputs=gr.Image(type="pil", label="Detections"),
title="Object Detection API",
)
demo.launch()