Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,14 +8,14 @@ whisper_client = Client("https://sanchit-gandhi-whisper-large-v2.hf.space/")
|
|
| 8 |
import re
|
| 9 |
|
| 10 |
def format_lyrics(text):
|
| 11 |
-
# Use regex to find parts that start with a capital letter
|
| 12 |
-
|
| 13 |
-
formatted_text = re.sub(pattern, r'\n\2', text)
|
| 14 |
|
| 15 |
# Remove any leading whitespace on each line
|
| 16 |
formatted_text = re.sub(r'^[ \t]+', '', formatted_text, flags=re.MULTILINE)
|
| 17 |
|
| 18 |
return formatted_text
|
|
|
|
| 19 |
|
| 20 |
def infer(audio_input):
|
| 21 |
|
|
|
|
| 8 |
import re
|
| 9 |
|
| 10 |
def format_lyrics(text):
|
| 11 |
+
# Use regex to find parts that start with a capital letter and insert a newline
|
| 12 |
+
formatted_text = re.sub(r'(?<!^)([A-Z])', r'\n\1', text)
|
|
|
|
| 13 |
|
| 14 |
# Remove any leading whitespace on each line
|
| 15 |
formatted_text = re.sub(r'^[ \t]+', '', formatted_text, flags=re.MULTILINE)
|
| 16 |
|
| 17 |
return formatted_text
|
| 18 |
+
|
| 19 |
|
| 20 |
def infer(audio_input):
|
| 21 |
|