hunterschep commited on
Commit
6b9e1d9
·
verified ·
1 Parent(s): 55890d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -35
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
- title.update(value="阿美語轉錄與修正系統"),
139
- step1.update(value="步驟 1:音訊上傳與轉錄"),
140
- step2.update(value="步驟 2:審閱與編輯轉錄"),
141
- step3.update(value="步驟 3:使用者資訊"),
142
- step4.update(value="步驟 4:儲存與下載"),
143
- audio_input.update(label="音訊輸入"),
144
- transcribe_button.update(value="轉錄音訊"),
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
- title.update(value="Amis ASR Transcription & Correction System"),
156
- step1.update(value="Step 1: Audio Upload & Transcription"),
157
- step2.update(value="Step 2: Review & Edit Transcription"),
158
- step3.update(value="Step 3: User Information"),
159
- step4.update(value="Step 4: Save & Download"),
160
- audio_input.update(label="Audio Input"),
161
- transcribe_button.update(value="Transcribe Audio"),
162
- original_text.update(label="Original Transcription"),
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, audio_input, transcribe_button,
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(