Benjamin Bossan commited on
Commit
fcf26dc
1 Parent(s): b0fda72

Add tooltips to buttons

Browse files
Files changed (1) hide show
  1. edit.py +19 -5
edit.py CHANGED
@@ -201,6 +201,7 @@ def create_form_from_section(
201
  on_click=_delete_section,
202
  args=(model_card, key),
203
  key=f"{key}.delete",
 
204
  )
205
  with col_1:
206
  st.button(
@@ -208,6 +209,7 @@ def create_form_from_section(
208
  on_click=_add_section,
209
  args=(model_card, key),
210
  key=f"{key}.add",
 
211
  )
212
  with col_2:
213
  st.button(
@@ -215,6 +217,7 @@ def create_form_from_section(
215
  on_click=_add_figure,
216
  args=(model_card, key),
217
  key=f"{key}.fig",
 
218
  )
219
 
220
 
@@ -266,7 +269,14 @@ def add_download_model_card_button():
266
  model_card = st.session_state.get("model_card")
267
  download_disabled = not bool(model_card)
268
  data = model_card.render()
269
- st.download_button("Save (md)", data=data, disabled=download_disabled)
 
 
 
 
 
 
 
270
 
271
 
272
  def edit_input_form():
@@ -279,18 +289,22 @@ def edit_input_form():
279
  redo_disabled = not bool(st.session_state.task_state.undone_list)
280
  with col_0:
281
  name = f"UNDO ({len(st.session_state.task_state.done_list)})"
282
- st.button(name, on_click=undo_last, disabled=undo_disabled)
 
283
  with col_1:
284
  name = f"REDO ({len(st.session_state.task_state.undone_list)})"
285
- st.button(name, on_click=redo_last, disabled=redo_disabled)
 
286
  with col_2:
287
- st.button("Reset", on_click=reset_model_card)
 
288
 
289
  col_0, col_1, *_ = st.columns([2, 2, 2, 2])
290
  with col_0:
291
  add_download_model_card_button()
292
  with col_1:
293
- st.button("Delete", on_click=delete_model_card)
 
294
 
295
  if "model_card" in st.session_state:
296
  display_sections(st.session_state.model_card)
 
201
  on_click=_delete_section,
202
  args=(model_card, key),
203
  key=f"{key}.delete",
204
+ help="Delete this section",
205
  )
206
  with col_1:
207
  st.button(
 
209
  on_click=_add_section,
210
  args=(model_card, key),
211
  key=f"{key}.add",
212
+ help="Add a new section below this section",
213
  )
214
  with col_2:
215
  st.button(
 
217
  on_click=_add_figure,
218
  args=(model_card, key),
219
  key=f"{key}.fig",
220
+ help="Add a new figure below this section",
221
  )
222
 
223
 
 
269
  model_card = st.session_state.get("model_card")
270
  download_disabled = not bool(model_card)
271
  data = model_card.render()
272
+ tip = "Download the generated model card as markdown file"
273
+ st.download_button(
274
+ "Save (md)",
275
+ data=data,
276
+ disabled=download_disabled,
277
+ help=tip,
278
+ file_name="README.md",
279
+ )
280
 
281
 
282
  def edit_input_form():
 
289
  redo_disabled = not bool(st.session_state.task_state.undone_list)
290
  with col_0:
291
  name = f"UNDO ({len(st.session_state.task_state.done_list)})"
292
+ tip = "Undo the last edit"
293
+ st.button(name, on_click=undo_last, disabled=undo_disabled, help=tip)
294
  with col_1:
295
  name = f"REDO ({len(st.session_state.task_state.undone_list)})"
296
+ tip = "Redo the last undone edit"
297
+ st.button(name, on_click=redo_last, disabled=redo_disabled, help=tip)
298
  with col_2:
299
+ tip = "Undo all edits"
300
+ st.button("Reset", on_click=reset_model_card, help=tip)
301
 
302
  col_0, col_1, *_ = st.columns([2, 2, 2, 2])
303
  with col_0:
304
  add_download_model_card_button()
305
  with col_1:
306
+ tip = "Start over from scratch (lose all progress)"
307
+ st.button("Delete", on_click=delete_model_card, help=tip)
308
 
309
  if "model_card" in st.session_state:
310
  display_sections(st.session_state.model_card)