turhancan97 commited on
Commit
161fbc4
·
1 Parent(s): 5f60f25

app deploy

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -49,7 +49,7 @@ def getOrientation(pts, img):
49
 
50
  ## [visualization]
51
  # Draw the principal components
52
- cv2.circle(img, cntr, 3, (255, 0, 255), 10)
53
  p1 = (cntr[0] + 0.02 * eigenvectors[0,0] * eigenvalues[0,0], cntr[1] + 0.02 * eigenvectors[0,1] * eigenvalues[0,0])
54
  p2 = (cntr[0] - 0.02 * eigenvectors[1,0] * eigenvalues[1,0], cntr[1] - 0.02 * eigenvectors[1,1] * eigenvalues[1,0])
55
  drawAxis(img, cntr, p1, (255, 255, 0), 1)
@@ -60,9 +60,9 @@ def getOrientation(pts, img):
60
  angle_deg = -(int(np.rad2deg(angle))-180) % 180
61
 
62
  # Label with the rotation angle
63
- label = " Rotation Angle: " + str(int(np.rad2deg(angle))) + " degrees"
64
- textbox = cv2.rectangle(img, (cntr[0], cntr[1]-25), (cntr[0] + 250, cntr[1] + 10), (255,255,255), -1)
65
- cv2.putText(img, label, (cntr[0], cntr[1]), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,0,0), 1, cv2.LINE_AA)
66
 
67
  return angle_deg
68
 
@@ -146,7 +146,7 @@ interface_image = gr.Interface(
146
  fn=show_preds_image,
147
  inputs=inputs_image,
148
  outputs=outputs_image,
149
- title="Pothole detector app",
150
  examples=path,
151
  cache_examples=False,
152
  )
@@ -181,7 +181,7 @@ interface_video = gr.Interface(
181
  fn=show_preds_video,
182
  inputs=inputs_video,
183
  outputs=outputs_video,
184
- title="Pothole detector",
185
  examples=video_path,
186
  cache_examples=False,
187
  )
 
49
 
50
  ## [visualization]
51
  # Draw the principal components
52
+ cv2.circle(img, cntr, 3, (255, 0, 255), 15)
53
  p1 = (cntr[0] + 0.02 * eigenvectors[0,0] * eigenvalues[0,0], cntr[1] + 0.02 * eigenvectors[0,1] * eigenvalues[0,0])
54
  p2 = (cntr[0] - 0.02 * eigenvectors[1,0] * eigenvalues[1,0], cntr[1] - 0.02 * eigenvectors[1,1] * eigenvalues[1,0])
55
  drawAxis(img, cntr, p1, (255, 255, 0), 1)
 
60
  angle_deg = -(int(np.rad2deg(angle))-180) % 180
61
 
62
  # Label with the rotation angle
63
+ label = str(int(np.rad2deg(angle))) + " deg"
64
+ textbox = cv2.rectangle(img, (cntr[0]+60, cntr[1]-25), (cntr[0] + 150, cntr[1] + 10), (255,255,255), -1)
65
+ cv2.putText(img, label, (cntr[0]+60, cntr[1]), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,0,0), 1, cv2.LINE_AA)
66
 
67
  return angle_deg
68
 
 
146
  fn=show_preds_image,
147
  inputs=inputs_image,
148
  outputs=outputs_image,
149
+ title="Trash Detection with Orientation",
150
  examples=path,
151
  cache_examples=False,
152
  )
 
181
  fn=show_preds_video,
182
  inputs=inputs_video,
183
  outputs=outputs_video,
184
+ title="Trash Detection with Orientation",
185
  examples=video_path,
186
  cache_examples=False,
187
  )