Spaces:
Paused
Paused
Update inference/infer.py
Browse files- inference/infer.py +7 -17
inference/infer.py
CHANGED
|
@@ -121,27 +121,17 @@ stage1_output_set = []
|
|
| 121 |
# genre tags support instrumental,genre,mood,vocal timbr and vocal gender
|
| 122 |
# all kinds of tags are needed
|
| 123 |
# Ensure files exist
|
| 124 |
-
|
| 125 |
-
with open(args.genre_txt, encoding="utf-8") as f:
|
| 126 |
genres = f.read().strip()
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
# Format lyrics content and ensure proper newline spacing between blocks
|
| 133 |
-
formatted_lyrics = "\n\n".join([block.strip() for block in raw_lyrics.split("\n\n")])
|
| 134 |
-
|
| 135 |
-
# Now, split the formatted lyrics into blocks
|
| 136 |
-
lyrics = split_lyrics(formatted_lyrics)
|
| 137 |
-
|
| 138 |
-
# Join all lyrics into one single string for the full lyrics
|
| 139 |
full_lyrics = "\n".join(lyrics)
|
| 140 |
-
|
| 141 |
-
# Prepare the prompt with genre and full lyrics
|
| 142 |
prompt_texts = [f"Generate music from the given lyrics segment by segment.\n[Genre] {genres}\n{full_lyrics}"]
|
| 143 |
prompt_texts += lyrics
|
| 144 |
-
|
| 145 |
|
| 146 |
random_id = uuid.uuid4()
|
| 147 |
output_seq = None
|
|
|
|
| 121 |
# genre tags support instrumental,genre,mood,vocal timbr and vocal gender
|
| 122 |
# all kinds of tags are needed
|
| 123 |
# Ensure files exist
|
| 124 |
+
with open(args.genre_txt) as f:
|
|
|
|
| 125 |
genres = f.read().strip()
|
| 126 |
+
print(genres)
|
| 127 |
+
with open(args.lyrics_txt) as f:
|
| 128 |
+
lyrics = split_lyrics(f.read())
|
| 129 |
+
print(lyrics)
|
| 130 |
+
# intruction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
full_lyrics = "\n".join(lyrics)
|
|
|
|
|
|
|
| 132 |
prompt_texts = [f"Generate music from the given lyrics segment by segment.\n[Genre] {genres}\n{full_lyrics}"]
|
| 133 |
prompt_texts += lyrics
|
| 134 |
+
print(prompt_texts)
|
| 135 |
|
| 136 |
random_id = uuid.uuid4()
|
| 137 |
output_seq = None
|