Calotriton commited on
Commit
c8adc9b
Β·
verified Β·
1 Parent(s): 04e155f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -140,18 +140,22 @@ def infer(audio_path, sensitivity):
140
  if not results:
141
  return "πŸ” **No species confidently detected.**\nTry reducing the strictness."
142
 
143
- # sort and format Markdown
144
  results.sort(key=lambda x: -x[1])
145
  md = "### βœ… Detected species:\n"
146
  for sp, p in results:
147
- md += f"- **{sp}** β€” probability: {p}\n"
148
  return md
149
 
150
  # ----------------------------
151
  # 6) Gradio Blocks interface
152
  # ----------------------------
153
  with gr.Blocks() as demo:
154
- gr.Markdown("# 🐸 RibbID – Amphibian Call Identifier\n")
 
 
 
 
155
  gr.Markdown(
156
  "**Detection strictness** controls how conservative the model is:\n\n"
157
  "- Lower values (0.5) = more sensitive (may include false positives).\n"
@@ -159,7 +163,7 @@ with gr.Blocks() as demo:
159
  )
160
 
161
  with gr.Row():
162
- audio = gr.Audio(type="filepath", label="Upload audio file (.wav/.mp3)")
163
  slider = gr.Slider(0.5, 1.0, value=1.0, step=0.05,
164
  label="Detection strictness")
165
 
@@ -170,8 +174,8 @@ with gr.Blocks() as demo:
170
  fn=infer,
171
  inputs=[audio, slider],
172
  outputs=[output],
173
- show_progress=True # <-- esto activa el spinner desde el primer click
174
  )
175
 
176
  if __name__ == "__main__":
177
- demo.launch(share=False)
 
140
  if not results:
141
  return "πŸ” **No species confidently detected.**\nTry reducing the strictness."
142
 
143
+ # sort and format Markdown with italics species names
144
  results.sort(key=lambda x: -x[1])
145
  md = "### βœ… Detected species:\n"
146
  for sp, p in results:
147
+ md += f"- *{sp}* β€” probability: {p}\n"
148
  return md
149
 
150
  # ----------------------------
151
  # 6) Gradio Blocks interface
152
  # ----------------------------
153
  with gr.Blocks() as demo:
154
+ gr.Markdown("# 🐸 RibbID – Amphibian species identifier\n")
155
+ # Intro sentence about native species
156
+ gr.Markdown(
157
+ "This model detects only the native frog and toad species of Catalonia (Northern Spain)."
158
+ )
159
  gr.Markdown(
160
  "**Detection strictness** controls how conservative the model is:\n\n"
161
  "- Lower values (0.5) = more sensitive (may include false positives).\n"
 
163
  )
164
 
165
  with gr.Row():
166
+ audio = gr.Audio(type="filepath", label="Upload audio file (.wav/.mp3) or record live")
167
  slider = gr.Slider(0.5, 1.0, value=1.0, step=0.05,
168
  label="Detection strictness")
169
 
 
174
  fn=infer,
175
  inputs=[audio, slider],
176
  outputs=[output],
177
+ show_progress=True
178
  )
179
 
180
  if __name__ == "__main__":
181
+ demo.launch(share=False)