Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,18 @@ splt_client = Client("https://fffiloni-splittrack2musicgen.hf.space/")
|
|
5 |
#whisper_client = Client("https://sanchit-gandhi-whisper-jax.hf.space/")
|
6 |
whisper_client = Client("https://sanchit-gandhi-whisper-large-v2.hf.space/")
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def infer(audio_input):
|
9 |
|
10 |
# STEP 1 | Split vocals from the song/audio file
|
@@ -27,7 +39,9 @@ def infer(audio_input):
|
|
27 |
|
28 |
#return whisper_result[0] # if using JAX
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
css = """
|
33 |
#col-container {max-width: 510px; margin-left: auto; margin-right: auto;}
|
|
|
5 |
#whisper_client = Client("https://sanchit-gandhi-whisper-jax.hf.space/")
|
6 |
whisper_client = Client("https://sanchit-gandhi-whisper-large-v2.hf.space/")
|
7 |
|
8 |
+
import re
|
9 |
+
|
10 |
+
def format_lyrics(text):
|
11 |
+
# Use regex to find parts that start with a capital letter
|
12 |
+
pattern = r'(^|\n)([A-Z][^\n]*)'
|
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 |
|
22 |
# STEP 1 | Split vocals from the song/audio file
|
|
|
39 |
|
40 |
#return whisper_result[0] # if using JAX
|
41 |
|
42 |
+
lyrics = format_lyrics(whisper_result)
|
43 |
+
|
44 |
+
return splt_result, lyrics
|
45 |
|
46 |
css = """
|
47 |
#col-container {max-width: 510px; margin-left: auto; margin-right: auto;}
|