Spaces:
Runtime error
Runtime error
File size: 1,115 Bytes
3cbf1d1 e101990 46f1985 e101990 f7fc015 e101990 97e91df e101990 f7fc015 e101990 59c8457 4d98c09 e101990 8981abe e101990 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import torch
import gradio as gr
from huggingface_hub import hf_hub_download
from PIL import Image
REPO_ID = "michaelwja/burn-detection"
FILENAME = "skin_burn.pt"
yolov7_custom_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME,repo_type='space')
model = torch.hub.load('WongKinYiu/yolov7:main',model='custom', path_or_model=yolov7_custom_weights, force_reload=True)
def object_detection(im, size=614):
results = model(im)
results.render()
return Image.fromarray(results.imgs[0])
title = "Yolov7 Skin Burn Detection"
image = gr.inputs.Image(shape=(614,614), image_mode="RGB", source="upload", label="Upload Image", optional=False)
outputs = gr.outputs.Image(type="pil", label="Output Image")
Top_Title="Yolov7 Skin Burn Detection | 基于Yolov7的深度学习皮肤烧伤检测模型"
Custom_description="Upload Any Burn Image to Begin. Made by Michael.W"
Footer="北京清华附中计算机高研社团@THIS 2023"
gr.Interface(
fn=object_detection,
inputs=image,
outputs=outputs,
title=Top_Title,
description=Custom_description,
article=Footer,).launch()
|