-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.py
executable file
·39 lines (35 loc) · 1.26 KB
/
Home.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# pylint: disable=invalid-name
"""App that adds pdf files to Anki among other things"""
import streamlit as st
from pta_processing import add_pta
# Write the introduction text
st.write(
"""
# Add PDF to Anki
This script allows you to add a **PDF** file to **Anki** as a deck of cards.
In this case, each card contains one page of the PDF file.
The cards are _marked_ and _suspended_ by default.
That way, they are not taken into account in the study routine until they are edited and made ready.
"""
)
# Create the form
with st.form("pta-form", clear_on_submit=True):
st.write(
"""
### Data entry
Use the following form to enter the necessary details for the script to run.
"""
)
deck_name = st.text_area(
"Deck Name",
help="The deck name may include parents, for more information see syntax for nested decks.",
)
pdf_full_path = st.text_area(
"File Full Path", help="The full path must include the file name and extension."
)
extract_text = st.checkbox("Extract text")
st.write("_Please verify the entered information before running the script._")
submitted = st.form_submit_button("Add file to Anki")
# Run the script on submission
if submitted:
add_pta(deck_name, pdf_full_path, extract_text)