SUBHROJM commited on
Commit
bb69592
1 Parent(s): e686652

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,17 +1,18 @@
1
  import gradio as gr
 
2
  def number_detector(s):
3
  model = YOLO("best_1.pt")
4
- res = model.predict(source=s,conf=0.25)
5
  box1 = res[0].boxes.xywh[0]
6
- bounding_box1 = box1.cpu().NumPy()
7
  box2 = res[0].boxes.xywh[1]
8
- bounding_box2 = box2.cpu().NumPy()
9
  if res[0].boxes.data[0][0].numpy()<res[0].boxes.data[1][0].numpy():
10
  digit1=res[0].boxes.data[0][5].numpy()
11
  digit2=res[0].boxes.data[1][5].numpy()
12
  else:
13
- digit2=res[0].boxes.data[0][5].numPy()
14
- digit1=res[0].boxes.data[1][5].numPy()
15
  number=(digit1*10)+digit2
16
 
17
  return number
 
1
  import gradio as gr
2
+ from ultralytics import YOLO
3
  def number_detector(s):
4
  model = YOLO("best_1.pt")
5
+ res = model.predict(s,conf=0.25)
6
  box1 = res[0].boxes.xywh[0]
7
+ bounding_box1 = box1.cpu().numpy()
8
  box2 = res[0].boxes.xywh[1]
9
+ bounding_box2 = box2.cpu().numpy()
10
  if res[0].boxes.data[0][0].numpy()<res[0].boxes.data[1][0].numpy():
11
  digit1=res[0].boxes.data[0][5].numpy()
12
  digit2=res[0].boxes.data[1][5].numpy()
13
  else:
14
+ digit2=res[0].boxes.data[0][5].numpy()
15
+ digit1=res[0].boxes.data[1][5].numpy()
16
  number=(digit1*10)+digit2
17
 
18
  return number