Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
from ultralytics import YOLO
|
3 |
|
4 |
-
|
5 |
|
6 |
def response(image):
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
+
from PIL import Image
|
4 |
from ultralytics import YOLO
|
5 |
|
6 |
+
model = YOLO('best(1).pt')
|
7 |
|
8 |
def response(image):
|
9 |
+
results = model(image)
|
10 |
+
# Plot results image
|
11 |
+
im_bgr = results.plot() # BGR-order numpy array
|
12 |
+
im_rgb = im_bgr[..., ::-1] # Convert BGR to RGB
|
13 |
+
return im_rgb
|
14 |
+
|
15 |
+
iface = gr.Interface(fn=response, input="image", output="image")
|
16 |
+
iface.launch()
|