derek-thomas HF staff commited on
Commit
7405c46
1 Parent(s): 9316a19

Markdown updates

Browse files
Files changed (1) hide show
  1. app.py +29 -23
app.py CHANGED
@@ -37,6 +37,7 @@ def anki_optimizer(file, timezone, next_day_starts_at, revlog_start_date, reques
37
  w_markdown = f"""
38
  # Updated Parameters
39
  Copy and paste these as shown in step 5 of the instructions:
 
40
  `var w = {w};`
41
 
42
  Check out the Analysis tab for more detailed information."""
@@ -46,29 +47,30 @@ def anki_optimizer(file, timezone, next_day_starts_at, revlog_start_date, reques
46
  cleanup(proj_dir, files)
47
  return w_markdown, df_out, fig, markdown_out, files_out
48
 
 
 
 
 
 
 
 
49
 
50
  with gr.Blocks() as demo:
51
  with gr.Tab("FSRS4Anki Optimizer"):
52
  with gr.Box():
53
- gr.Markdown("""
54
- Based on the [tutorial](https://medium.com/@JarrettYe/how-to-use-the-next-generation-spaced-repetition-algorithm-fsrs-on-anki-5a591ca562e2) of [Jarrett Ye](https://github.com/L-M-Sherlock).
55
- This application can give you updated parameters without having to code.
56
-
57
- Check out the instructions on the next tab.
58
- """)
59
  with gr.Box():
60
  with gr.Row():
61
- file = gr.File(label='Review Logs')
62
- timezone = gr.Dropdown(label="Choose your timezone", choices=pytz.all_timezones)
63
- with gr.Row():
64
- next_day_starts_at = gr.Number(value=4,
65
- label="Replace it with your Anki's setting in Preferences -> Scheduling.",
66
- precision=0)
67
- with gr.Accordion(label="Advanced Settings", open=False):
68
- requestRetention = gr.Number(value=.9, label="Recommended to set between 0.8 0.9")
69
- with gr.Row():
70
- revlog_start_date = gr.Textbox(value="2006-10-05",
71
- label="Replace it if you don't want the optimizer to use the review logs before a specific date.")
72
  with gr.Row():
73
  btn_plot = gr.Button('Optimize your Anki!')
74
  with gr.Row():
@@ -82,23 +84,27 @@ with gr.Blocks() as demo:
82
 
83
  This is based on the amazing work of [Jarrett Ye](https://github.com/L-M-Sherlock). My goal is to further
84
  democratize this technology so anyone can use it!
85
- # Step 1 - Get the review logs to upload
86
  1. Click the gear icon to the right of a deck’s name
87
  2. Export
88
  3. Check “Include scheduling information” and “Support older Anki versions”
89
  ![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*W3Nnfarki2z7Ukyom4kMuw.png)
90
  4. Export and upload that file to the app
91
 
92
- # Step 2 - Get the `next_day_starts_at` parameter
93
  1. Open preferences
94
  2. Copy the next day starts at value and paste it in the app
95
  ![](https://miro.medium.com/v2/resize:fit:1072/format:webp/1*qAUb6ry8UxFeCsjnKLXvsQ.png)
96
 
97
  # Step 3 - Fill in the rest of the settings
 
 
98
 
99
- # Step 4 - Click run
 
 
100
 
101
- # Step 5 - Replace the default parameters in FSRS4Anki with the optimized parameters
102
  ![](https://miro.medium.com/v2/resize:fit:1252/format:webp/1*NM4CR-n7nDk3nQN1Bi30EA.png)
103
  """)
104
  with gr.Tab("Analysis"):
@@ -112,6 +118,6 @@ with gr.Blocks() as demo:
112
  btn_plot.click(anki_optimizer,
113
  inputs=[file, timezone, next_day_starts_at, revlog_start_date, requestRetention],
114
  outputs=[w_output, df_output, plot_output, markdown_output, files_output])
115
- demo.queue().launch(debug=True, show_error=True)
116
 
117
- # demo.queue().launch(debug=True)
 
 
37
  w_markdown = f"""
38
  # Updated Parameters
39
  Copy and paste these as shown in step 5 of the instructions:
40
+
41
  `var w = {w};`
42
 
43
  Check out the Analysis tab for more detailed information."""
 
47
  cleanup(proj_dir, files)
48
  return w_markdown, df_out, fig, markdown_out, files_out
49
 
50
+ description = """
51
+ # FSRS4Anki Optimizer App
52
+ Based on the [tutorial](https://medium.com/@JarrettYe/how-to-use-the-next-generation-spaced-repetition-algorithm-fsrs-on-anki-5a591ca562e2)
53
+ of [Jarrett Ye](https://github.com/L-M-Sherlock). This application can give you personalized parameters without having to code.
54
+
55
+ Read the `Instructions` if its your first time using the app.
56
+ """
57
 
58
  with gr.Blocks() as demo:
59
  with gr.Tab("FSRS4Anki Optimizer"):
60
  with gr.Box():
61
+ gr.Markdown(description)
 
 
 
 
 
62
  with gr.Box():
63
  with gr.Row():
64
+ file = gr.File(label='Review Logs (Step 1)')
65
+ with gr.Column():
66
+ next_day_starts_at = gr.Number(value=4,
67
+ label="Next Day Starts at (Step 2)",
68
+ precision=0)
69
+ timezone = gr.Dropdown(label="Timezone (Step 3.1)", choices=pytz.all_timezones)
70
+ with gr.Accordion(label="Advanced Settings (Step 3.2)", open=False):
71
+ requestRetention = gr.Number(value=.9, label="Recommended to set between 0.8 0.9")
72
+ revlog_start_date = gr.Textbox(value="2006-10-05",
73
+ label="Replace it if you don't want the optimizer to use the review logs before a specific date.")
 
74
  with gr.Row():
75
  btn_plot = gr.Button('Optimize your Anki!')
76
  with gr.Row():
 
84
 
85
  This is based on the amazing work of [Jarrett Ye](https://github.com/L-M-Sherlock). My goal is to further
86
  democratize this technology so anyone can use it!
87
+ # Step 1 - Get the `Review Logs` to upload
88
  1. Click the gear icon to the right of a deck’s name
89
  2. Export
90
  3. Check “Include scheduling information” and “Support older Anki versions”
91
  ![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*W3Nnfarki2z7Ukyom4kMuw.png)
92
  4. Export and upload that file to the app
93
 
94
+ # Step 2 - Get the `Next Day Starts At` parameter
95
  1. Open preferences
96
  2. Copy the next day starts at value and paste it in the app
97
  ![](https://miro.medium.com/v2/resize:fit:1072/format:webp/1*qAUb6ry8UxFeCsjnKLXvsQ.png)
98
 
99
  # Step 3 - Fill in the rest of the settings
100
+ 1. Your `Time Zone`
101
+ 2. `Advanced settings` if you know what you are doing
102
 
103
+ # Step 4 - Click `Optimize your Anki!`
104
+ 1. After it runs copy `var w = [...]`
105
+ 2. Check out the analysis tab for more info
106
 
107
+ # Step 5 - Update FSRS4Anki with the optimized parameters
108
  ![](https://miro.medium.com/v2/resize:fit:1252/format:webp/1*NM4CR-n7nDk3nQN1Bi30EA.png)
109
  """)
110
  with gr.Tab("Analysis"):
 
118
  btn_plot.click(anki_optimizer,
119
  inputs=[file, timezone, next_day_starts_at, revlog_start_date, requestRetention],
120
  outputs=[w_output, df_output, plot_output, markdown_output, files_output])
 
121
 
122
+ if __name__ == '__main__':
123
+ demo.queue().launch(show_error=True)