fffiloni commited on
Commit
8a4962f
·
verified ·
1 Parent(s): 374b657

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -54,6 +54,12 @@ def transcribe(inputs, task):
54
  import re
55
 
56
  def format_lyrics(text):
 
 
 
 
 
 
57
  # Use regex to find parts that start with a capital letter and insert a newline
58
  formatted_text = re.sub(r'(?<!^)([A-Z])', r'\n\1', text)
59
 
 
54
  import re
55
 
56
  def format_lyrics(text):
57
+ # Remove unwanted subtitle artifacts
58
+ text = re.sub(r"Sous-?titrage Société Radio-Canada", "", text, flags=re.IGNORECASE)
59
+
60
+ # Optionally remove repeated whitespace or multiple newlines
61
+ text = re.sub(r'\n+', '\n', text).strip()
62
+
63
  # Use regex to find parts that start with a capital letter and insert a newline
64
  formatted_text = re.sub(r'(?<!^)([A-Z])', r'\n\1', text)
65