llzzyy233 commited on
Commit
2c9f733
1 Parent(s): 6c08baf

将图片转换为英文显示

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -5,8 +5,6 @@ from ultralytics import YOLO
5
  import matplotlib.pyplot as plt
6
  import io
7
  from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
8
- plt.rcParams['font.family'] = 'SimHei' # 用来正常显示中文标签
9
- plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
10
  model = YOLO(r'pcb-best.pt')
11
 
12
 
@@ -38,10 +36,10 @@ def predict(img, conf, iou):
38
  categories = ['Copper', 'Mousebite', 'Open Defect', 'Pin Hole', 'Short', 'Spur']
39
  counts = [copper, mousebite, open_defect, pin_hole, short, spur]
40
  ax.bar(categories, counts)
41
- ax.set_title('缺陷类别计数')
42
  plt.ylim(0,5)
43
- ax.set_xlabel('缺陷类别')
44
- ax.set_ylabel('数目')
45
  # 将图表保存为字节流
46
  buf = io.BytesIO()
47
  canvas = FigureCanvas(fig)
 
5
  import matplotlib.pyplot as plt
6
  import io
7
  from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
 
 
8
  model = YOLO(r'pcb-best.pt')
9
 
10
 
 
36
  categories = ['Copper', 'Mousebite', 'Open Defect', 'Pin Hole', 'Short', 'Spur']
37
  counts = [copper, mousebite, open_defect, pin_hole, short, spur]
38
  ax.bar(categories, counts)
39
+ ax.set_title('Category-Count')
40
  plt.ylim(0,5)
41
+ ax.set_xlabel('Category')
42
+ ax.set_ylabel('Count')
43
  # 将图表保存为字节流
44
  buf = io.BytesIO()
45
  canvas = FigureCanvas(fig)