Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +38 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ultralytics import YOLO
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
model = YOLO('yolov8m.pt')
|
| 5 |
+
|
| 6 |
+
def detect(image):
|
| 7 |
+
|
| 8 |
+
results = model(image) # predict on an image
|
| 9 |
+
res_plotted = results[0].plot()
|
| 10 |
+
|
| 11 |
+
return res_plotted
|
| 12 |
+
|
| 13 |
+
############################################################################
|
| 14 |
+
# ***************START OF YOUR INPUT***************
|
| 15 |
+
description="""
|
| 16 |
+
|
| 17 |
+
Description
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
title = """
|
| 22 |
+
|
| 23 |
+
Title
|
| 24 |
+
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
examples = [['example1.jpg']]
|
| 28 |
+
# ***************END OF YOUR INPUT***************
|
| 29 |
+
############################################################################
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
gr.Interface(fn=detect,
|
| 33 |
+
inputs="image",
|
| 34 |
+
outputs="image",
|
| 35 |
+
live=True,
|
| 36 |
+
title=title,
|
| 37 |
+
description=description,
|
| 38 |
+
examples=examples).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ultralytics
|
| 2 |
+
Pillow
|
| 3 |
+
numpy
|
| 4 |
+
pandas
|