Jass0117 commited on
Commit
6819d12
·
verified ·
1 Parent(s): b3a0406

Create appt.py

Browse files
Files changed (1) hide show
  1. appt.py +21 -0
appt.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import gradio as gr
4
+
5
+ from ultralytics import YOLO
6
+
7
+ def predict(path:str):
8
+ model = YOLO("yolov8s.yaml")
9
+ model = YOLO("best-underwater.pt")
10
+ imagen = cv2.imread(path)
11
+ results = model.predict(source=path)
12
+
13
+ for r in results:
14
+ return r.plot()
15
+
16
+ css = """
17
+ body {background-color: #ff0000;} """
18
+
19
+ gr.Interface(fn=predict,
20
+ inputs=gr.components.Image(type="filepath", label="Input"),
21
+ outputs=gr.components.Image(type="numpy", label="Output"), css=css).launch(debug=False)