JarrettYe commited on
Commit
a7657f2
1 Parent(s): d23fd16

update to v4.3.0

Browse files
Files changed (2) hide show
  1. app.py +9 -6
  2. requirements.txt +1 -1
app.py CHANGED
@@ -20,10 +20,13 @@ def get_w_markdown(w):
20
 
21
  `{w}`
22
 
23
- Check out the Analysis tab for more detailed information."""
 
 
 
24
 
25
 
26
- def anki_optimizer(file: gr.File, timezone, next_day_starts_at, revlog_start_date, requestRetention,
27
  progress=gr.Progress(track_tqdm=True)):
28
  os.chdir('/home/user/app')
29
  if file is None or (not file.name.endswith(".apkg") and not file.name.endswith(".colpkg")):
@@ -38,11 +41,11 @@ def anki_optimizer(file: gr.File, timezone, next_day_starts_at, revlog_start_dat
38
  proj_dir = Path(f'projects/{prefix}/{suffix}')
39
  proj_dir.mkdir(parents=True, exist_ok=True)
40
  os.chdir(proj_dir)
41
- print(os.getcwd())
42
  optimizer = Optimizer()
43
  optimizer.anki_extract(file.name)
44
- analysis_markdown = optimizer.create_time_series(timezone, revlog_start_date, next_day_starts_at).replace("\n", "\n\n")
45
  optimizer.define_model()
 
46
  optimizer.train(verbose=False)
47
  print(optimizer.w)
48
  w_markdown = get_w_markdown(optimizer.w)
@@ -71,7 +74,6 @@ def anki_optimizer(file: gr.File, timezone, next_day_starts_at, revlog_start_dat
71
  {rating_markdown}
72
  """
73
  os.chdir('/home/user/app')
74
- print(os.getcwd())
75
  files_out = [proj_dir / file for file in files if (proj_dir / file).exists()]
76
  cleanup(proj_dir, files)
77
  plt.close('all')
@@ -99,6 +101,7 @@ with gr.Blocks() as demo:
99
  label="Next Day Starts at (Step 2)",
100
  precision=0)
101
  timezone = gr.Dropdown(label="Timezone (Step 3.1)", choices=pytz.all_timezones)
 
102
  with gr.Accordion(label="Advanced Settings (Step 3.2)", open=False):
103
  requestRetention = gr.Number(value=.9, label="Desired Retention: Recommended to set between 0.8 0.9")
104
  revlog_start_date = gr.Textbox(value="2006-10-05",
@@ -120,7 +123,7 @@ with gr.Blocks() as demo:
120
  gr.Markdown(faq_markdown)
121
 
122
  btn_plot.click(anki_optimizer,
123
- inputs=[file, timezone, next_day_starts_at, revlog_start_date, requestRetention],
124
  outputs=[w_output, markdown_output, plot_output, files_output])
125
 
126
  demo.queue().launch(show_error=True)
 
20
 
21
  `{w}`
22
 
23
+ Check out the Analysis tab for more detailed information.
24
+
25
+ **Note**: These values should be used with FSRS scheduler v4.0.0 or above.
26
+ """
27
 
28
 
29
+ def anki_optimizer(file: gr.File, timezone, next_day_starts_at, revlog_start_date, filter_out_suspended_cards, requestRetention,
30
  progress=gr.Progress(track_tqdm=True)):
31
  os.chdir('/home/user/app')
32
  if file is None or (not file.name.endswith(".apkg") and not file.name.endswith(".colpkg")):
 
41
  proj_dir = Path(f'projects/{prefix}/{suffix}')
42
  proj_dir.mkdir(parents=True, exist_ok=True)
43
  os.chdir(proj_dir)
 
44
  optimizer = Optimizer()
45
  optimizer.anki_extract(file.name)
46
+ analysis_markdown = optimizer.create_time_series(timezone, revlog_start_date, next_day_starts_at, filter_out_suspended_cards).replace("\n", "\n\n")
47
  optimizer.define_model()
48
+ optimizer.pretrain(verbose=False)
49
  optimizer.train(verbose=False)
50
  print(optimizer.w)
51
  w_markdown = get_w_markdown(optimizer.w)
 
74
  {rating_markdown}
75
  """
76
  os.chdir('/home/user/app')
 
77
  files_out = [proj_dir / file for file in files if (proj_dir / file).exists()]
78
  cleanup(proj_dir, files)
79
  plt.close('all')
 
101
  label="Next Day Starts at (Step 2)",
102
  precision=0)
103
  timezone = gr.Dropdown(label="Timezone (Step 3.1)", choices=pytz.all_timezones)
104
+ filter_out_suspended_cards = gr.Checkbox(value=False, label="Filter out suspended cards")
105
  with gr.Accordion(label="Advanced Settings (Step 3.2)", open=False):
106
  requestRetention = gr.Number(value=.9, label="Desired Retention: Recommended to set between 0.8 0.9")
107
  revlog_start_date = gr.Textbox(value="2006-10-05",
 
123
  gr.Markdown(faq_markdown)
124
 
125
  btn_plot.click(anki_optimizer,
126
+ inputs=[file, timezone, next_day_starts_at, revlog_start_date, filter_out_suspended_cards, requestRetention],
127
  outputs=[w_output, markdown_output, plot_output, files_output])
128
 
129
  demo.queue().launch(show_error=True)
requirements.txt CHANGED
@@ -1 +1 @@
1
- fsrs4anki_optimizer==3.26.1
 
1
+ fsrs4anki_optimizer==4.3.0