Spaces:
Sleeping
Sleeping
上傳卡片文案與版面微調(千卉截圖回饋)
Browse files1. 修掉 .upload-hint 雙重水平線 bug:Gradio 把 elem_classes 同時蓋在外層
wrapper 跟內層 .prose 兩個 div 上,CSS border-bottom 因此疊出兩條線;
拿掉 border-bottom,只留 margin 當間距。
2. 四個情境的格式要求(SCENARIOS[n]["upload_prompt"])新增明確的「檔案格式:
僅接受 .txt 純文字檔」條目(原本只在檔名規範的範例裡隱含),其餘項目
跟著重新編號。
3. file_input(拖曳上傳卡片)拿掉 label,改用 show_label=False,跟卡片本身
的「📂 上傳已斷詞文本」標題重複。
已用 Playwright 截圖確認:格式要求下方無多餘線條、新增的 .txt 說明正確
顯示、拖放框不再有多餘標籤文字。
- app_agent.py +21 -16
app_agent.py
CHANGED
|
@@ -99,9 +99,10 @@ SCENARIOS = {
|
|
| 99 |
"title": "同一原文的人工翻譯 vs 機器翻譯",
|
| 100 |
"short": "人機對比",
|
| 101 |
"upload_prompt": (
|
| 102 |
-
"1. 檔
|
| 103 |
-
"2.
|
| 104 |
-
"3.
|
|
|
|
| 105 |
),
|
| 106 |
"desc": "焦點在人機差異的語言特徵。",
|
| 107 |
"scenario_module_key": "scenario_2",
|
|
@@ -110,9 +111,10 @@ SCENARIOS = {
|
|
| 110 |
"title": "全譯 vs 編譯(節譯、改寫)",
|
| 111 |
"short": "全譯vs編譯",
|
| 112 |
"upload_prompt": (
|
| 113 |
-
"1. 檔
|
| 114 |
-
"2.
|
| 115 |
-
"3.
|
|
|
|
| 116 |
),
|
| 117 |
"desc": "焦點在文本完整性和改寫策略。",
|
| 118 |
"scenario_module_key": "scenario_3",
|
|
@@ -121,9 +123,10 @@ SCENARIOS = {
|
|
| 121 |
"title": "不同譯者的同期譯本",
|
| 122 |
"short": "譯者風格",
|
| 123 |
"upload_prompt": (
|
| 124 |
-
"1. 檔
|
| 125 |
-
"2.
|
| 126 |
-
"3.
|
|
|
|
| 127 |
),
|
| 128 |
"desc": "焦點在個人風格差異。排除時代因素,討論譯者個人的語言偏好。",
|
| 129 |
"scenario_module_key": "scenario_4",
|
|
@@ -132,9 +135,10 @@ SCENARIOS = {
|
|
| 132 |
"title": "同一原文的不同時期人工譯本",
|
| 133 |
"short": "歷時重譯",
|
| 134 |
"upload_prompt": (
|
| 135 |
-
"1. 檔
|
| 136 |
-
"2.
|
| 137 |
-
"3.
|
|
|
|
| 138 |
),
|
| 139 |
"desc": "分析焦點在歷時變化、語言現代化、翻譯規範的演變。時間維度是核心變數。",
|
| 140 |
"scenario_module_key": "scenario_1",
|
|
@@ -2401,10 +2405,11 @@ div[role="log"][aria-label="chatbot conversation"],
|
|
| 2401 |
}
|
| 2402 |
/* 格式要求直接寫在上傳卡片裡,跟卡片本身有明顯區隔但仍在同一張卡片內,
|
| 2403 |
使用者不用往上捲回對話視窗找 AI 說過的規則 */
|
| 2404 |
-
/* 已經在 upload-zone 卡片裡了,卡片本身就有外框,這裡不再加第二層框線/底色
|
| 2405 |
-
|
|
|
|
|
|
|
| 2406 |
.upload-hint {
|
| 2407 |
-
border-bottom: 1px solid rgba(var(--c-accent-rgb),.16) !important;
|
| 2408 |
padding: 0 0 .9rem !important;
|
| 2409 |
margin-bottom: .9rem !important;
|
| 2410 |
font-size: var(--font-size-base) !important;
|
|
@@ -3015,7 +3020,7 @@ def create_app():
|
|
| 3015 |
with gr.Column(visible=False, elem_id="upload_zone", elem_classes=["upload-zone"]) as upload_row:
|
| 3016 |
upload_hint_md = gr.Markdown(value="", elem_classes=["upload-hint"])
|
| 3017 |
file_input = gr.File(
|
| 3018 |
-
|
| 3019 |
file_types=[".txt"], file_count="multiple",
|
| 3020 |
)
|
| 3021 |
with gr.Row(elem_classes=["upload-actions"]):
|
|
|
|
| 99 |
"title": "同一原文的人工翻譯 vs 機器翻譯",
|
| 100 |
"short": "人機對比",
|
| 101 |
"upload_prompt": (
|
| 102 |
+
"1. 檔案格式:僅接受 **.txt** 純文字檔。\n"
|
| 103 |
+
"2. 檔名規範:請以 **A_xx.txt**、**B_xx.txt** 等格式區分人工翻譯與機器翻譯。\n"
|
| 104 |
+
"3. 斷詞要求:必須先使用 I 語料淬鍊 工具完成斷詞。\n"
|
| 105 |
+
"4. 內容格式:僅限 `詞_詞性`、`_詞性` 或空白行。"
|
| 106 |
),
|
| 107 |
"desc": "焦點在人機差異的語言特徵。",
|
| 108 |
"scenario_module_key": "scenario_2",
|
|
|
|
| 111 |
"title": "全譯 vs 編譯(節譯、改寫)",
|
| 112 |
"short": "全譯vs編譯",
|
| 113 |
"upload_prompt": (
|
| 114 |
+
"1. 檔案格式:僅接受 **.txt** 純文字檔。\n"
|
| 115 |
+
"2. 檔名規範:請以 **A_xx.txt**、**B_xx.txt** 等格式區分全譯與編譯。\n"
|
| 116 |
+
"3. 斷詞要求:必須先使用 I 語料淬鍊 工具完成斷詞。\n"
|
| 117 |
+
"4. 內容格式:僅限 `詞_詞性`、`_詞性` 或空白行。"
|
| 118 |
),
|
| 119 |
"desc": "焦點在文本完整性和改寫策略。",
|
| 120 |
"scenario_module_key": "scenario_3",
|
|
|
|
| 123 |
"title": "不同譯者的同期譯本",
|
| 124 |
"short": "譯者風格",
|
| 125 |
"upload_prompt": (
|
| 126 |
+
"1. 檔案格式:僅接受 **.txt** 純文字檔。\n"
|
| 127 |
+
"2. 檔名規範:請以 **A_xx.txt**、**B_xx.txt**、**C_xx.txt** 等格式區分不同群組的譯者。\n"
|
| 128 |
+
"3. 斷詞要求:必須先使用 I 語料淬鍊 工具完成斷詞。\n"
|
| 129 |
+
"4. 內容格式:僅限 `詞_詞性`、`_詞性` 或空白行。"
|
| 130 |
),
|
| 131 |
"desc": "焦點在個人風格差異。排除時代因素,討論譯者個人的語言偏好。",
|
| 132 |
"scenario_module_key": "scenario_4",
|
|
|
|
| 135 |
"title": "同一原文的不同時期人工譯本",
|
| 136 |
"short": "歷時重譯",
|
| 137 |
"upload_prompt": (
|
| 138 |
+
"1. 檔案格式:僅接受 **.txt** 純文字檔。\n"
|
| 139 |
+
"2. 檔名規範:請以 **A_xx.txt**、**B_xx.txt**、**C_xx.txt** 等格式區分不同時期的譯本。\n"
|
| 140 |
+
"3. 斷詞要求:必須先使用 I 語料淬鍊 工具完成斷詞。\n"
|
| 141 |
+
"4. 內容格式:僅限 `詞_詞性`、`_詞性` 或空白行。"
|
| 142 |
),
|
| 143 |
"desc": "分析焦點在歷時變化、語言現代化、翻譯規範的演變。時間維度是核心變數。",
|
| 144 |
"scenario_module_key": "scenario_1",
|
|
|
|
| 2405 |
}
|
| 2406 |
/* 格式要求直接寫在上傳卡片裡,跟卡片本身有明顯區隔但仍在同一張卡片內,
|
| 2407 |
使用者不用往上捲回對話視窗找 AI 說過的規則 */
|
| 2408 |
+
/* 已經在 upload-zone 卡片裡了,卡片本身就有外框,這裡不再加第二層框線/底色。
|
| 2409 |
+
注意:不要在這裡加 border-bottom——Gradio 把 elem_classes 同時蓋在外層
|
| 2410 |
+
wrapper 跟內層 .prose 兩個 div 上,兩個都命中 .upload-hint 會疊出兩條
|
| 2411 |
+
看起來像雙重分隔線的邊框(已踩坑,千卉截圖抓到),只留 margin 當間距 */
|
| 2412 |
.upload-hint {
|
|
|
|
| 2413 |
padding: 0 0 .9rem !important;
|
| 2414 |
margin-bottom: .9rem !important;
|
| 2415 |
font-size: var(--font-size-base) !important;
|
|
|
|
| 3020 |
with gr.Column(visible=False, elem_id="upload_zone", elem_classes=["upload-zone"]) as upload_row:
|
| 3021 |
upload_hint_md = gr.Markdown(value="", elem_classes=["upload-hint"])
|
| 3022 |
file_input = gr.File(
|
| 3023 |
+
show_label=False,
|
| 3024 |
file_types=[".txt"], file_count="multiple",
|
| 3025 |
)
|
| 3026 |
with gr.Row(elem_classes=["upload-actions"]):
|