Skip to content

Commit

Permalink
feat (gui): lang choices
Browse files Browse the repository at this point in the history
  • Loading branch information
reycn committed Dec 19, 2024
1 parent b095857 commit f4cc1ff
Showing 1 changed file with 37 additions and 16 deletions.
53 changes: 37 additions & 16 deletions pdf2zh/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ def progress_bar(t: tqdm.tqdm):
}
.env-success {
color: #559900 !important;
}
.lang-row {
border: none !important;
}
.logo {
border: transparent;
Expand Down Expand Up @@ -666,9 +670,21 @@ def cancel_options():

# First Tab: Local Document
with gr.Blocks() as tab_main:
with gr.Row(elem_classes=["lang-row"]):
gui_li = gr.Dropdown(
label="Translate from",
choices=["Auto", "English"],
value=env_lo.value,
interactive=True,
)
gui_lo = gr.Dropdown(
label="To",
choices=["Chinese", "English"],
value=env_lo.value,
interactive=True,
)
with gr.Row(elem_classes=["preview-row"]):
preview = PDF(
label="Translated",
visible=False,
height=1200,
elem_classes=["preview-block"],
Expand Down Expand Up @@ -789,20 +805,20 @@ def on_file_upload_translate(file, first_page_only):
with gr.Blocks(visible=True, elem_classes=["options-modal"]) as tab_option:
with gr.Row():
with gr.Column():
gr.Markdown("### Translation")
with gr.Group():
gui_li = gr.Dropdown(
label="Source",
choices=["Chinese", "English"],
value=env_lo.value,
interactive=True,
)
gui_lo = gr.Dropdown(
label="Target",
choices=["Chinese", "English"],
value=env_lo.value,
interactive=True,
)
# gr.Markdown("### Translation")
# with gr.Group():
# gui_li = gr.Dropdown(
# label="Source",
# choices=["Chinese", "English"],
# value=env_lo.value,
# interactive=True,
# )
# gui_lo = gr.Dropdown(
# label="Target",
# choices=["Chinese", "English"],
# value=env_lo.value,
# interactive=True,
# )
gr.Markdown("### Service")
gui_service = gr.Dropdown(
label="Provider",
Expand Down Expand Up @@ -895,7 +911,12 @@ def on_file_upload_translate(file, first_page_only):
[tab_main, tab_url, tab_option],
["Local Document", "Online Document", "Advanced Options"],
)
gr.Markdown(tech_details_string, elem_classes=["secondary-text"])
gr.Markdown(
"""The file will be translated into Chinese.
More languages supported in [advanced options](https://github.com/Byaidu/PDFMathTranslate/issues).""",
elem_classes=["info-text"],
)
# gr.Markdown(tech_details_string, elem_classes=["secondary-text"])


# state = gr.State({"session_id": None})
Expand Down

0 comments on commit f4cc1ff

Please sign in to comment.