yaron123 commited on
Commit
fb42270
·
1 Parent(s): 87d9c22
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -557,7 +557,7 @@ def summarize_text(
557
  summary = pegasus_tokenizer.decode( pegasus_model.generate(
558
  pegasus_tokenizer(text,return_tensors="pt").input_ids,
559
  max_length=max_length,
560
- num_beams = 2,
561
  early_stopping=True
562
  )[0], skip_special_tokens=True)
563
  log(f'RET summarize_text with summary as {summary}')
@@ -631,6 +631,7 @@ def handle_generation(artist,song,genre,lyrics):
631
 
632
  pos_lyrics = re.sub(f'[{punctuation}]', '', re.sub("([ \t\n]){1,}", " ", lyrics)).lower().strip()
633
  pos_lyrics_sum = pos_lyrics if pos_lyrics == "" else summarize_text(pos_lyrics)
 
634
  neg = f"Sexual, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly-Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
635
  q = "\""
636
  pos = f'Photorealistic, Hyperrealistic, Realistic Photography, High-Quality Photography, Natural, made for the { pos_genre } song "{ pos_song }"{ pos_lyrics_sum if pos_lyrics_sum == "" else ": " + q + pos_lyrics_sum + q }.'
@@ -646,7 +647,8 @@ def handle_generation(artist,song,genre,lyrics):
646
  index = 1
647
  names = []
648
  for img in imgs:
649
- labeled_img = add_song_cover_text(img,artist,song,height*4,width*4)
 
650
  name = f'{artist} - {song} ({index}).png'
651
  labeled_img.save(name)
652
  names.append(name)
 
557
  summary = pegasus_tokenizer.decode( pegasus_model.generate(
558
  pegasus_tokenizer(text,return_tensors="pt").input_ids,
559
  max_length=max_length,
560
+ num_beams = 4,
561
  early_stopping=True
562
  )[0], skip_special_tokens=True)
563
  log(f'RET summarize_text with summary as {summary}')
 
631
 
632
  pos_lyrics = re.sub(f'[{punctuation}]', '', re.sub("([ \t\n]){1,}", " ", lyrics)).lower().strip()
633
  pos_lyrics_sum = pos_lyrics if pos_lyrics == "" else summarize_text(pos_lyrics)
634
+
635
  neg = f"Sexual, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly-Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
636
  q = "\""
637
  pos = f'Photorealistic, Hyperrealistic, Realistic Photography, High-Quality Photography, Natural, made for the { pos_genre } song "{ pos_song }"{ pos_lyrics_sum if pos_lyrics_sum == "" else ": " + q + pos_lyrics_sum + q }.'
 
647
  index = 1
648
  names = []
649
  for img in imgs:
650
+ scaled_by = 2
651
+ labeled_img = add_song_cover_text(img,artist,song,height*scaled_by,width*scaled_by)
652
  name = f'{artist} - {song} ({index}).png'
653
  labeled_img.save(name)
654
  names.append(name)