|
|
@@ -188,6 +188,11 @@ def translate_file(
|
|
|
def progress_bar(t: tqdm.tqdm):
|
|
|
progress(t.n / t.total, desc="Translating...")
|
|
|
|
|
|
+ try:
|
|
|
+ threads = int(threads)
|
|
|
+ except ValueError:
|
|
|
+ threads = 1
|
|
|
+
|
|
|
param = {
|
|
|
"files": [str(file_raw)],
|
|
|
"pages": selected_page,
|
|
|
@@ -195,7 +200,7 @@ def translate_file(
|
|
|
"lang_out": lang_to,
|
|
|
"service": f"{translator.name}",
|
|
|
"output": output,
|
|
|
- "thread": int(threads),
|
|
|
+ "thread": threads,
|
|
|
"callback": progress_bar,
|
|
|
"cancellation_event": cancellation_event_map[session_id],
|
|
|
"envs": _envs,
|
|
|
@@ -342,7 +347,9 @@ with gr.Blocks(
|
|
|
|
|
|
with gr.Accordion("Open for More Experimental Options!", open=False):
|
|
|
gr.Markdown("#### Experimental")
|
|
|
- threads = gr.Textbox(label="number of threads", interactive=True)
|
|
|
+ threads = gr.Textbox(
|
|
|
+ label="number of threads", interactive=True, value="1"
|
|
|
+ )
|
|
|
prompt = gr.Textbox(
|
|
|
label="Custom Prompt for llm", interactive=True, visible=False
|
|
|
)
|