firgiawann commited on
Commit
62bc038
·
verified ·
1 Parent(s): b066dd6

Fix Gradio load every incompatibility using Timer tick (update 19)

Browse files
Files changed (2) hide show
  1. CHANGELOG.md +5 -0
  2. app.py +7 -2
CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
  # Changelog
2
 
 
 
 
 
 
3
  ## Update ke-18 - 2026-04-15
4
  - Training diubah ke mode background process (`subprocess`) sehingga tetap berjalan di server walau koneksi client terputus.
5
  - Ditambah monitor status training (`Status training`, `Refresh Status Training`) + polling otomatis tiap 2 detik saat UI terbuka.
 
1
  # Changelog
2
 
3
+ ## Update ke-19 - 2026-04-15
4
+ - Fix startup crash di Space: ganti `demo.load(..., every=2)` ke kombinasi `demo.load(...)` + `gr.Timer(...).tick(...)`.
5
+ - Kompatibel dengan versi Gradio pada runtime Space yang tidak mendukung argumen `every` di `load`.
6
+ - Minor update dinaikkan ke-19.
7
+
8
  ## Update ke-18 - 2026-04-15
9
  - Training diubah ke mode background process (`subprocess`) sehingga tetap berjalan di server walau koneksi client terputus.
10
  - Ditambah monitor status training (`Status training`, `Refresh Status Training`) + polling otomatis tiap 2 detik saat UI terbuka.
app.py CHANGED
@@ -25,7 +25,7 @@ from ultralytics import YOLO
25
  CM_INIT = {"tp": 0, "fp": 0, "fn": 0, "tn": 0}
26
  EVAL_CLASSES = ["Sesuai", "Tidak Sesuai"]
27
  APP_VERSION = os.getenv("APP_VERSION", "v0.9.0")
28
- APP_MINOR_UPDATE = os.getenv("APP_MINOR_UPDATE", "18")
29
 
30
 
31
  # Gradio/Spaces can trigger noisy asyncio cleanup traces ("Invalid file descriptor: -1")
@@ -1323,7 +1323,12 @@ with gr.Blocks(title="Pengecekan dan Klasifikasi Mahasiswa - YOLOv8") as demo:
1323
  fn=poll_training_status,
1324
  inputs=[],
1325
  outputs=[train_log, best_model_file, train_curve, train_status_md],
1326
- every=2,
 
 
 
 
 
1327
  )
1328
 
1329
  gr.HTML(
 
25
  CM_INIT = {"tp": 0, "fp": 0, "fn": 0, "tn": 0}
26
  EVAL_CLASSES = ["Sesuai", "Tidak Sesuai"]
27
  APP_VERSION = os.getenv("APP_VERSION", "v0.9.0")
28
+ APP_MINOR_UPDATE = os.getenv("APP_MINOR_UPDATE", "19")
29
 
30
 
31
  # Gradio/Spaces can trigger noisy asyncio cleanup traces ("Invalid file descriptor: -1")
 
1323
  fn=poll_training_status,
1324
  inputs=[],
1325
  outputs=[train_log, best_model_file, train_curve, train_status_md],
1326
+ )
1327
+ train_timer = gr.Timer(value=2.0)
1328
+ train_timer.tick(
1329
+ fn=poll_training_status,
1330
+ inputs=[],
1331
+ outputs=[train_log, best_model_file, train_curve, train_status_md],
1332
  )
1333
 
1334
  gr.HTML(