jbobym commited on
Commit
0e82a59
verified
1 Parent(s): 512150a

Restore deep-link share button under prediction box (lost in Blocks rewrite)

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -146,6 +146,7 @@ LABELS: dict[str, dict[str, str]] = {
146
  "notes_output": "Notes",
147
  "submit": "Classify",
148
  "clear": "Clear",
 
149
  },
150
  "fr": {
151
  "lang_radio": "Language / Langue",
@@ -154,6 +155,7 @@ LABELS: dict[str, dict[str, str]] = {
154
  "notes_output": "Remarques",
155
  "submit": "Classer",
156
  "clear": "Effacer",
 
157
  },
158
  }
159
 
@@ -356,6 +358,7 @@ with gr.Blocks(theme=theme, title="Chronic Wound Classifier 路 H么pital Montfort
356
  with gr.Column():
357
  label_output = gr.Label(num_top_classes=4, label=LABELS["en"]["label_output"])
358
  notes_output = gr.Markdown(label=LABELS["en"]["notes_output"])
 
359
 
360
  article_md = gr.Markdown(ARTICLE["en"])
361
 
@@ -377,7 +380,7 @@ with gr.Blocks(theme=theme, title="Chronic Wound Classifier 路 H么pital Montfort
377
 
378
  def _on_language_change(
379
  language_choice: str, current_image: Image.Image | None
380
- ) -> tuple[dict, dict, dict, dict, dict, dict, dict, str]:
381
  lang = _lang_code(language_choice)
382
  labels = LABELS[lang]
383
  # Re-run inference so the on-screen probability labels switch languages too.
@@ -390,6 +393,7 @@ with gr.Blocks(theme=theme, title="Chronic Wound Classifier 路 H么pital Montfort
390
  gr.update(label=labels["label_output"], value=new_probs),
391
  gr.update(value=labels["submit"]),
392
  gr.update(value=labels["clear"]),
 
393
  new_notes,
394
  )
395
 
@@ -404,6 +408,7 @@ with gr.Blocks(theme=theme, title="Chronic Wound Classifier 路 H么pital Montfort
404
  label_output,
405
  submit_btn,
406
  clear_btn,
 
407
  notes_output,
408
  ],
409
  )
 
146
  "notes_output": "Notes",
147
  "submit": "Classify",
148
  "clear": "Clear",
149
+ "share": "Share this prediction",
150
  },
151
  "fr": {
152
  "lang_radio": "Language / Langue",
 
155
  "notes_output": "Remarques",
156
  "submit": "Classer",
157
  "clear": "Effacer",
158
+ "share": "Partager cette pr茅diction",
159
  },
160
  }
161
 
 
358
  with gr.Column():
359
  label_output = gr.Label(num_top_classes=4, label=LABELS["en"]["label_output"])
360
  notes_output = gr.Markdown(label=LABELS["en"]["notes_output"])
361
+ share_btn = gr.DeepLinkButton(value=LABELS["en"]["share"])
362
 
363
  article_md = gr.Markdown(ARTICLE["en"])
364
 
 
380
 
381
  def _on_language_change(
382
  language_choice: str, current_image: Image.Image | None
383
+ ) -> tuple[dict, dict, dict, dict, dict, dict, dict, dict, str]:
384
  lang = _lang_code(language_choice)
385
  labels = LABELS[lang]
386
  # Re-run inference so the on-screen probability labels switch languages too.
 
393
  gr.update(label=labels["label_output"], value=new_probs),
394
  gr.update(value=labels["submit"]),
395
  gr.update(value=labels["clear"]),
396
+ gr.update(value=labels["share"]),
397
  new_notes,
398
  )
399
 
 
408
  label_output,
409
  submit_btn,
410
  clear_btn,
411
+ share_btn,
412
  notes_output,
413
  ],
414
  )