layout_anal / app.py
cccornflake's picture
Upload app.py
760b7e1 verified
raw
history blame
571 Bytes
import gradio as gr
import PIL.Image as Image
from ultralytics import YOLO
model = YOLO('./best.pt')
def infer(img_path):
results = model(img_path)
im_array = results[0].plot()
im = Image.fromarray(im_array[..., ::-1])
return im
article = "**์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜์„ธ์š”.**" \
demo = gr.Interface(fn=infer,
inputs=gr.Image(type="numpy", label="Input Image"),
outputs=gr.Image(type="pil", label="Result")
# examples=[image_path,]
)
demo.launch(share=True, server_port=7671)