wookimchye commited on
Commit
135e43d
·
verified ·
1 Parent(s): 9d4d41a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -62,8 +62,8 @@ def process_image(pilimg):
62
  #font = ImageFont.truetype("arialbd.ttf", 30) # Use arial.ttf for bold font
63
 
64
  draw.text((250, 10), "Good", fill="green", font=font)
65
- #gr.Info("No defect detected, GOOD!", duration=3)
66
- summary_str = "No defect is detected, the cap is GOOD!"
67
 
68
  else: # Defective
69
  detection_result = detect_defect(pilimg)
@@ -79,13 +79,14 @@ def process_image(pilimg):
79
 
80
  detections = detection_result[0].boxes.data # Get detections
81
  if len(detections) > 0:
82
- #gr.Warning("Defect detected, BAD!", duration=3)
83
- summary_str = "Defect is detected, the cap is BAD"
84
  else:
85
- #gr.Warning("Classified as Defective but defect cannot be detected, ERROR!")
86
- summary_str = "The cap is classifed as Defective but the defect cannot be detected!"
87
 
88
- return out_pilimg, f"**{summary_str}**"
 
89
 
90
  title = "Detect the status of the cap: DEFECTIVE or GOOD"
91
  interface = gr.Interface(
 
62
  #font = ImageFont.truetype("arialbd.ttf", 30) # Use arial.ttf for bold font
63
 
64
  draw.text((250, 10), "Good", fill="green", font=font)
65
+ #summary_str = "No defect is detected, the cap is GOOD!"
66
+ summary_str = f"<span style='font-size:30px; font-weight:bold; color:green'>No defect is detected, the cap is GOOD!</span>"
67
 
68
  else: # Defective
69
  detection_result = detect_defect(pilimg)
 
79
 
80
  detections = detection_result[0].boxes.data # Get detections
81
  if len(detections) > 0:
82
+ #summary_str = "Defect is detected, the cap is BAD"
83
+ summary_str = f"<span style='font-size:30px; font-weight:bold; color:red'>Defect is detected, the cap is BAD!</span>"
84
  else:
85
+ #summary_str = "The cap is classifed as Defective but the defect cannot be detected!"
86
+ summary_str = f"<span style='font-size:30px; font-weight:bold; color:blue'>The cap is classifed as Defective but the defect cannot be detected!</span>"
87
 
88
+ #return out_pilimg, f"**{summary_str}**"
89
+ return out_pilimg, summary_str
90
 
91
  title = "Detect the status of the cap: DEFECTIVE or GOOD"
92
  interface = gr.Interface(