ahmedxeno commited on
Commit
4ae08c7
·
1 Parent(s): 9b102c9

Upload 2 files

Browse files
Files changed (2) hide show
  1. app (3).py +21 -0
  2. requirements (2).txt +4 -0
app (3).py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+ import numpy as np
4
+ from ultralytics import YOLO
5
+
6
+ model = YOLO('best (7).pt')
7
+
8
+ def predict_image(img):
9
+
10
+ model = YOLO('best (7).pt')
11
+ result = model.predict(img,conf=0.97)
12
+ res_plotted = result[0].plot()
13
+ #cv2.imshow( res_plotted)
14
+ return res_plotted
15
+
16
+
17
+
18
+ image = gr.inputs.Image()
19
+
20
+ label = gr.outputs.Label('ok')
21
+ gr.Interface(fn=predict_image, inputs=image, outputs=image).launch(debug='True')
requirements (2).txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ultralytics
2
+ opencv-python
3
+ numpy
4
+ gradio