avans06 commited on
Commit
7bdbe2a
2 Parent(s): 3ab1530 852f4fa

Merge branch 'main' of https://huggingface.co/spaces/avans06/whisper-webui

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -252,6 +252,18 @@ class WhisperTranscriber:
252
  return download, text, vtt
253
 
254
  finally:
 
 
 
 
 
 
 
 
 
 
 
 
255
  # Cleanup source
256
  if self.deleteUploadedFiles:
257
  for source in sources:
 
252
  return download, text, vtt
253
 
254
  finally:
255
+ if languageName == "Chinese":
256
+ for file_path in source_download:
257
+ try:
258
+ with open(file_path, "r+", encoding="utf-8") as source:
259
+ content = source.read()
260
+ content = zhconv.convert(content, "zh-tw")
261
+ source.seek(0)
262
+ source.write(content)
263
+ except Exception as e:
264
+ # Ignore error - it's just a cleanup
265
+ print("Error converting Traditional Chinese with download source file: \n" + file_path + ", \n" + str(e))
266
+
267
  # Cleanup source
268
  if self.deleteUploadedFiles:
269
  for source in sources: