chenchangliu commited on
Commit
f4bf3a3
·
verified ·
1 Parent(s): ed44347

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -77,13 +77,13 @@ def predict(image: Image.Image):
77
  sp_conf = float(prob_sp[sp_id].item())
78
  st_conf = float(prob_st[st_id].item())
79
 
80
- sp_text = f"{SPECIES[sp_id]} (id={sp_id}, conf={sp_conf:.3f})"
81
- st_text = f"{STATE[st_id]} (id={st_id}, conf={st_conf:.3f})"
82
 
83
  return sp_text, st_text
84
 
85
  EXAMPLE_TEXT = """
86
- 12 species: Cacoxnus indagator, Chelostoma florisomne, Coeliopencyrtus, Eumenidae,
87
  Heriades, Hylaeus, Megachile, Osmia bicornis, Osmia cornuta, Passaloecus, Psenulus, Trypoxylon
88
 
89
  4 states: DauLv, DeadLv, Lv, OldFood
@@ -93,7 +93,7 @@ demo = gr.Interface(
93
  fn=predict,
94
  inputs=gr.Image(type="pil"),
95
  outputs=[
96
- gr.Textbox(label="Predicted species"),
97
  gr.Textbox(label="Predicted state"),
98
  ],
99
  title="EfficientNet Two-Head Layer Trap Nest (LTN) Classifier",
 
77
  sp_conf = float(prob_sp[sp_id].item())
78
  st_conf = float(prob_st[st_id].item())
79
 
80
+ sp_text = f"{SPECIES[sp_id]} (id={sp_id}, score={sp_conf:.3f})"
81
+ st_text = f"{STATE[st_id]} (id={st_id}, score={st_conf:.3f})"
82
 
83
  return sp_text, st_text
84
 
85
  EXAMPLE_TEXT = """
86
+ 12 taxa: Cacoxnus indagator, Chelostoma florisomne, Coeliopencyrtus, Eumenidae,
87
  Heriades, Hylaeus, Megachile, Osmia bicornis, Osmia cornuta, Passaloecus, Psenulus, Trypoxylon
88
 
89
  4 states: DauLv, DeadLv, Lv, OldFood
 
93
  fn=predict,
94
  inputs=gr.Image(type="pil"),
95
  outputs=[
96
+ gr.Textbox(label="Predicted taxon"),
97
  gr.Textbox(label="Predicted state"),
98
  ],
99
  title="EfficientNet Two-Head Layer Trap Nest (LTN) Classifier",