treamyracle commited on
Commit
683386f
·
verified ·
1 Parent(s): 723c79d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -31,10 +31,9 @@ def process_image(image):
31
  results = model.predict(image_bgr, conf=0.25)
32
 
33
  # 3. Gambar Kotak & Label Otomatis
34
- # .plot() mengembalikan gambar dalam format BGR
35
- # show_labels=True -> Pastikan label teks muncul
36
- # show_conf=True -> Pastikan skor persentase muncul
37
- annotated_bgr = results[0].plot(show_labels=True, show_conf=True)
38
 
39
  # 4. Konversi Balik dari BGR ke RGB (Agar kulit tidak biru di Web)
40
  annotated_rgb = cv2.cvtColor(annotated_bgr, cv2.COLOR_BGR2RGB)
@@ -43,7 +42,7 @@ def process_image(image):
43
 
44
  # --- TAMPILAN WEB ---
45
  with gr.Blocks() as demo:
46
- gr.Markdown("# 👁️ Tes Model YOLO (Fixed Color & Labels)")
47
  gr.Markdown("Pastikan wajah tidak biru dan label muncul.")
48
 
49
  with gr.Row():
 
31
  results = model.predict(image_bgr, conf=0.25)
32
 
33
  # 3. Gambar Kotak & Label Otomatis
34
+ # PERBAIKAN DI SINI:
35
+ # Gunakan 'labels=True' dan 'conf=True' (bukan show_labels)
36
+ annotated_bgr = results[0].plot(labels=True, conf=True)
 
37
 
38
  # 4. Konversi Balik dari BGR ke RGB (Agar kulit tidak biru di Web)
39
  annotated_rgb = cv2.cvtColor(annotated_bgr, cv2.COLOR_BGR2RGB)
 
42
 
43
  # --- TAMPILAN WEB ---
44
  with gr.Blocks() as demo:
45
+ gr.Markdown("# 👁️ Tes Model YOLO (Final Fix)")
46
  gr.Markdown("Pastikan wajah tidak biru dan label muncul.")
47
 
48
  with gr.Row():