Update app.py
Browse files
app.py
CHANGED
@@ -133,40 +133,26 @@ def prepare_download(audio_file, original_transcription, corrected_transcription
|
|
133 |
return tmp_zip.name
|
134 |
|
135 |
def toggle_language(switch):
|
|
|
136 |
if switch:
|
137 |
-
return
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
original_text.update(label="原始轉錄"),
|
146 |
-
corrected_text.update(label="更正轉錄"),
|
147 |
-
age_input.update(label="年齡"),
|
148 |
-
native_speaker_input.update(label="以阿美語為母語?"),
|
149 |
-
save_button.update(value="儲存更正"),
|
150 |
-
save_status.update(label="儲存狀態"),
|
151 |
-
download_button.update(value="下載 ZIP 檔案")
|
152 |
-
]
|
153 |
else:
|
154 |
-
return
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
corrected_text.update(label="Corrected Transcription"),
|
164 |
-
age_input.update(label="Age"),
|
165 |
-
native_speaker_input.update(label="Native Amis Speaker?"),
|
166 |
-
save_button.update(value="Save Correction"),
|
167 |
-
save_status.update(label="Save Status"),
|
168 |
-
download_button.update(value="Download ZIP File")
|
169 |
-
]
|
170 |
# Interface
|
171 |
with gr.Blocks() as demo:
|
172 |
lang_switch = gr.Checkbox(label="切換到繁體中文 (Switch to Traditional Chinese)")
|
@@ -201,9 +187,7 @@ with gr.Blocks() as demo:
|
|
201 |
lang_switch.change(
|
202 |
toggle_language,
|
203 |
inputs=lang_switch,
|
204 |
-
outputs=[title, step1, step2, step3, step4
|
205 |
-
original_text, corrected_text, age_input, native_speaker_input,
|
206 |
-
save_button, save_status, download_button]
|
207 |
)
|
208 |
|
209 |
transcribe_button.click(
|
|
|
133 |
return tmp_zip.name
|
134 |
|
135 |
def toggle_language(switch):
|
136 |
+
"""Switch UI text between English and Traditional Chinese"""
|
137 |
if switch:
|
138 |
+
return (
|
139 |
+
"阿美語轉錄與修正系統",
|
140 |
+
"步驟 1:音訊上傳與轉錄",
|
141 |
+
"步驟 2:審閱與編輯轉錄",
|
142 |
+
"步驟 3:使用者資訊",
|
143 |
+
"步驟 4:儲存與下載",
|
144 |
+
# Remove component label updates from returns
|
145 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
else:
|
147 |
+
return (
|
148 |
+
"Amis ASR Transcription & Correction System",
|
149 |
+
"Step 1: Audio Upload & Transcription",
|
150 |
+
"Step 2: Review & Edit Transcription",
|
151 |
+
"Step 3: User Information",
|
152 |
+
"Step 4: Save & Download",
|
153 |
+
# Remove component label updates from returns
|
154 |
+
)
|
155 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
# Interface
|
157 |
with gr.Blocks() as demo:
|
158 |
lang_switch = gr.Checkbox(label="切換到繁體中文 (Switch to Traditional Chinese)")
|
|
|
187 |
lang_switch.change(
|
188 |
toggle_language,
|
189 |
inputs=lang_switch,
|
190 |
+
outputs=[title, step1, step2, step3, step4]
|
|
|
|
|
191 |
)
|
192 |
|
193 |
transcribe_button.click(
|