Benjamin Bossan commited on
Commit
248a59f
1 Parent(s): 4c1bb6f

Fix bug with deleting state

Browse files
Files changed (2) hide show
  1. create.py +3 -1
  2. edit.py +3 -1
create.py CHANGED
@@ -16,7 +16,8 @@ def _add_back_button():
16
 
17
  def _add_delete_button():
18
  def fn():
19
- st.session_state.screen.state = "start"
 
20
  if "model_card" in st.session_state:
21
  del st.session_state["model_card"]
22
  if "task_state" in st.session_state:
@@ -25,6 +26,7 @@ def _add_delete_button():
25
  del st.session_state["create_repo_name"]
26
  if "hf_token" in st.session_state:
27
  del st.session_state["hf_token"]
 
28
 
29
  st.button("Delete", on_click=fn, help="Start over from scratch (lose all progress)")
30
 
 
16
 
17
  def _add_delete_button():
18
  def fn():
19
+ if "hf_path" in st.session_state:
20
+ del st.session_state["hf_path"]
21
  if "model_card" in st.session_state:
22
  del st.session_state["model_card"]
23
  if "task_state" in st.session_state:
 
26
  del st.session_state["create_repo_name"]
27
  if "hf_token" in st.session_state:
28
  del st.session_state["hf_token"]
29
+ st.session_state.screen.state = "start"
30
 
31
  st.button("Delete", on_click=fn, help="Start over from scratch (lose all progress)")
32
 
edit.py CHANGED
@@ -278,11 +278,13 @@ def reset_model_card() -> None:
278
 
279
 
280
  def delete_model_card() -> None:
281
- st.session_state.screen.state = "start"
 
282
  if "model_card" in st.session_state:
283
  del st.session_state["model_card"]
284
  if "task_state" in st.session_state:
285
  st.session_state.task_state.reset()
 
286
 
287
 
288
  def undo_last():
 
278
 
279
 
280
  def delete_model_card() -> None:
281
+ if "hf_path" in st.session_state:
282
+ del st.session_state["hf_path"]
283
  if "model_card" in st.session_state:
284
  del st.session_state["model_card"]
285
  if "task_state" in st.session_state:
286
  st.session_state.task_state.reset()
287
+ st.session_state.screen.state = "start"
288
 
289
 
290
  def undo_last():