Spaces:
Running
Running
Update pdf2zh/gui.py
Browse files- pdf2zh/gui.py +10 -13
pdf2zh/gui.py
CHANGED
@@ -13,13 +13,13 @@ import cgi
|
|
13 |
|
14 |
# Map service names to pdf2zh service options
|
15 |
service_map = {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
"OpenAI": ("openai", "OPENAI_API_KEY", "gpt-4o"),
|
21 |
-
|
22 |
-
|
23 |
}
|
24 |
lang_map = {
|
25 |
"Chinese": "zh",
|
@@ -43,7 +43,6 @@ if os.environ.get("PDF2ZH_DEMO"):
|
|
43 |
flag_demo = True
|
44 |
service_map = {
|
45 |
"Google": ("google", None, None),
|
46 |
-
#"OpenAI": ("openai", "OPENAI_API_KEY", "gpt-4o"),
|
47 |
}
|
48 |
page_map = {
|
49 |
"First": [0],
|
@@ -214,7 +213,7 @@ custom_blue = gr.themes.Color(
|
|
214 |
)
|
215 |
|
216 |
with gr.Blocks(
|
217 |
-
title="
|
218 |
theme=gr.themes.Default(
|
219 |
primary_hue=custom_blue, spacing_size="md", radius_size="lg"
|
220 |
),
|
@@ -276,8 +275,7 @@ with gr.Blocks(
|
|
276 |
),
|
277 |
) as demo:
|
278 |
gr.Markdown(
|
279 |
-
|
280 |
-
"# [PDFMathTranslate-科研之心免费提供(更多科研AI智能体请点击)](https://ai.linkagi.top)"
|
281 |
)
|
282 |
|
283 |
with gr.Row():
|
@@ -305,8 +303,7 @@ with gr.Blocks(
|
|
305 |
service = gr.Dropdown(
|
306 |
label="Service",
|
307 |
choices=service_map.keys(),
|
308 |
-
|
309 |
-
value="OpenAI",
|
310 |
)
|
311 |
apikey = gr.Textbox(
|
312 |
label="API Key",
|
@@ -369,7 +366,7 @@ with gr.Blocks(
|
|
369 |
def on_select_service(service, evt: gr.EventData):
|
370 |
if service_map[service][1]:
|
371 |
apikey_content = gr.update(
|
372 |
-
visible=
|
373 |
)
|
374 |
else:
|
375 |
apikey_content = gr.update(visible=False)
|
|
|
13 |
|
14 |
# Map service names to pdf2zh service options
|
15 |
service_map = {
|
16 |
+
"Google": ("google", None, None),
|
17 |
+
"DeepL": ("deepl", "DEEPL_AUTH_KEY", None),
|
18 |
+
"DeepLX": ("deeplx", "DEEPLX_AUTH_KEY", None),
|
19 |
+
"Ollama": ("ollama", None, "gemma2"),
|
20 |
"OpenAI": ("openai", "OPENAI_API_KEY", "gpt-4o"),
|
21 |
+
"Azure": ("azure", "AZURE_APIKEY", None),
|
22 |
+
"Tencent": ("tencent", "TENCENT_SECRET_KEY", None),
|
23 |
}
|
24 |
lang_map = {
|
25 |
"Chinese": "zh",
|
|
|
43 |
flag_demo = True
|
44 |
service_map = {
|
45 |
"Google": ("google", None, None),
|
|
|
46 |
}
|
47 |
page_map = {
|
48 |
"First": [0],
|
|
|
213 |
)
|
214 |
|
215 |
with gr.Blocks(
|
216 |
+
title="PDFMathTranslate - PDF Translation with preserved formats",
|
217 |
theme=gr.themes.Default(
|
218 |
primary_hue=custom_blue, spacing_size="md", radius_size="lg"
|
219 |
),
|
|
|
275 |
),
|
276 |
) as demo:
|
277 |
gr.Markdown(
|
278 |
+
"# [PDFMathTranslate @ GitHub](https://github.com/Byaidu/PDFMathTranslate)"
|
|
|
279 |
)
|
280 |
|
281 |
with gr.Row():
|
|
|
303 |
service = gr.Dropdown(
|
304 |
label="Service",
|
305 |
choices=service_map.keys(),
|
306 |
+
value="Google",
|
|
|
307 |
)
|
308 |
apikey = gr.Textbox(
|
309 |
label="API Key",
|
|
|
366 |
def on_select_service(service, evt: gr.EventData):
|
367 |
if service_map[service][1]:
|
368 |
apikey_content = gr.update(
|
369 |
+
visible=True, value=os.environ.get(service_map[service][1])
|
370 |
)
|
371 |
else:
|
372 |
apikey_content = gr.update(visible=False)
|