chenchangliu commited on
Commit
3ece5b1
·
verified ·
1 Parent(s): 2ac1183

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -78,14 +78,18 @@ def predict(image: Image.Image):
78
  sp_conf = float(prob_sp[sp_id].item())
79
  st_conf = float(prob_st[st_id].item())
80
 
81
- sp_text = f"{SPECIES[sp_id]} (id={sp_id}, score={sp_conf:.3f})"
82
- st_text = f"{STATE[st_id]} (id={st_id}, score={st_conf:.3f})"
 
 
 
83
 
84
  return sp_text, st_text
85
 
86
 
87
  EXAMPLE_TEXT = """
88
  **Taxa (12):** Cacoxnus indagator, Chelostoma florisomne, Coeliopencyrtus, Eumenidae, Heriades, Hylaeus, Megachile, Osmia bicornis, Osmia cornuta, Passaloecus, Psenulus, Trypoxylon
 
89
  **States (4):** DauLv, DeadLv, Lv, OldFood
90
  """
91
 
@@ -136,10 +140,10 @@ with gr.Blocks(theme=theme, title="LTN EfficientNet Two-Head Classifier") as dem
136
  inputs=img,
137
  )
138
 
139
- gr.Markdown(
140
- "<small>Note: The status legend is a human-readable mapping. "
141
- "Your model output labels come from `labels.json`.</small>"
142
- )
143
 
144
  if __name__ == "__main__":
145
  demo.launch()
 
78
  sp_conf = float(prob_sp[sp_id].item())
79
  st_conf = float(prob_st[st_id].item())
80
 
81
+ #sp_text = f"{SPECIES[sp_id]} (id={sp_id}, score={sp_conf:.3f})"
82
+ #st_text = f"{STATE[st_id]} (id={st_id}, score={st_conf:.3f})"
83
+
84
+ sp_text = f"{SPECIES[sp_id]} (score={sp_conf:.3f})"
85
+ st_text = f"{STATE[st_id]} (score={st_conf:.3f})"
86
 
87
  return sp_text, st_text
88
 
89
 
90
  EXAMPLE_TEXT = """
91
  **Taxa (12):** Cacoxnus indagator, Chelostoma florisomne, Coeliopencyrtus, Eumenidae, Heriades, Hylaeus, Megachile, Osmia bicornis, Osmia cornuta, Passaloecus, Psenulus, Trypoxylon
92
+
93
  **States (4):** DauLv, DeadLv, Lv, OldFood
94
  """
95
 
 
140
  inputs=img,
141
  )
142
 
143
+ #gr.Markdown(
144
+ # "<small>Note: The status legend is a human-readable mapping. "
145
+ # "Your model output labels come from `labels.json`.</small>"
146
+ #)
147
 
148
  if __name__ == "__main__":
149
  demo.launch()