Spaces:
Paused
Paused
์ ์ํ
commited on
Commit
ยท
99ac2ba
1
Parent(s):
46c07d8
add app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import PIL.Image as Image
|
| 3 |
+
from ultralytics import YOLO
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
model = YOLO('./runs/ best.pt')
|
| 7 |
+
|
| 8 |
+
def infer(img_path):
|
| 9 |
+
results = model(img_path)
|
| 10 |
+
|
| 11 |
+
im_array = results[0].plot()
|
| 12 |
+
im = Image.fromarray(im_array[..., ::-1])
|
| 13 |
+
return im
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
article = "**์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ์ธ์.**" \
|
| 17 |
+
|
| 18 |
+
demo = gr.Interface(fn=infer,
|
| 19 |
+
inputs=gr.Image(type="numpy", label="Input Image"),
|
| 20 |
+
outputs=gr.Image(type="pil", label="Result")
|
| 21 |
+
# examples=[image_path,]
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
demo.launch(share=True, server_port=7671)
|