Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -566,7 +566,7 @@ def _summarize(text):
|
|
566 |
gen = model.generate(
|
567 |
toks,
|
568 |
length_penalty=0.1,
|
569 |
-
num_beams=
|
570 |
early_stopping=True,
|
571 |
max_length=512
|
572 |
)
|
@@ -1278,7 +1278,7 @@ def handle_generation(artist,song,genre,lyrics):
|
|
1278 |
pos_song = re.sub(r"([ \t]){1,}", " ", song).lower().strip()
|
1279 |
pos_song = ' '.join(word[0].upper() + word[1:] for word in pos_song.split())
|
1280 |
|
1281 |
-
lyrics = re.sub(r"
|
1282 |
lyrics_lines = re.split(r"([\n]){1,}", lyrics)
|
1283 |
|
1284 |
for line_index in range(len(lyrics_lines)):
|
@@ -1291,12 +1291,13 @@ def handle_generation(artist,song,genre,lyrics):
|
|
1291 |
pos_genre = re.sub(f'[{punctuation}]', '', re.sub(r"([ \t]){1,}", " ", genre)).lower().strip()
|
1292 |
pos_genre = ' '.join(word[0].upper() + word[1:] for word in pos_genre.split())
|
1293 |
|
1294 |
-
pos_lyrics = re.sub(
|
1295 |
-
|
|
|
1296 |
|
1297 |
neg = f"Sexuality, Human body, Human, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low-Quality, Painted, Smooth, Artificial, Phony, Gaudy, Digital Effects."
|
1298 |
q = "\""
|
1299 |
-
pos = f'{ translate(pos_genre) } song hyper-realistic official image{
|
1300 |
|
1301 |
print(f"""
|
1302 |
Positive: {pos}
|
|
|
566 |
gen = model.generate(
|
567 |
toks,
|
568 |
length_penalty=0.1,
|
569 |
+
num_beams=4,
|
570 |
early_stopping=True,
|
571 |
max_length=512
|
572 |
)
|
|
|
1278 |
pos_song = re.sub(r"([ \t]){1,}", " ", song).lower().strip()
|
1279 |
pos_song = ' '.join(word[0].upper() + word[1:] for word in pos_song.split())
|
1280 |
|
1281 |
+
lyrics = re.sub(r"[,]",".",lyrics)
|
1282 |
lyrics_lines = re.split(r"([\n]){1,}", lyrics)
|
1283 |
|
1284 |
for line_index in range(len(lyrics_lines)):
|
|
|
1291 |
pos_genre = re.sub(f'[{punctuation}]', '', re.sub(r"([ \t]){1,}", " ", genre)).lower().strip()
|
1292 |
pos_genre = ' '.join(word[0].upper() + word[1:] for word in pos_genre.split())
|
1293 |
|
1294 |
+
pos_lyrics = re.sub(r"([ \t]){1,}", " ", lyrics).lower().strip()
|
1295 |
+
pos_lyrics = pos_lyrics if pos_lyrics == "" else summarize(translate(pos_lyrics))
|
1296 |
+
pos_lyrics = re.sub(r"([ \t]){1,}", " ", re.sub(f'[{punctuation}]', '', pos_lyrics)).lower().strip()
|
1297 |
|
1298 |
neg = f"Sexuality, Human body, Human, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low-Quality, Painted, Smooth, Artificial, Phony, Gaudy, Digital Effects."
|
1299 |
q = "\""
|
1300 |
+
pos = f'{ translate(pos_genre) } song hyper-realistic official image{ pos_lyrics if pos_lyrics == "" else ": " + q + pos_lyrics + q }.'
|
1301 |
|
1302 |
print(f"""
|
1303 |
Positive: {pos}
|