yaron123 commited on
Commit
d0ad7e9
·
1 Parent(s): fb42270
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -31,7 +31,7 @@ from huggingface_hub import hf_hub_download
31
  from safetensors.torch import load_file, save_file
32
  from diffusers import FluxPipeline
33
  from PIL import Image, ImageDraw, ImageFont
34
- from transformers import PegasusForConditionalGeneration, PegasusTokenizer
35
  from refiners.fluxion.utils import manual_seed
36
  from refiners.foundationals.latent_diffusion import Solver, solvers
37
  from refiners.foundationals.latent_diffusion.stable_diffusion_1.multi_upscaler import (
@@ -502,8 +502,8 @@ image_pipe.enable_model_cpu_offload()
502
  image_pipe.enable_vae_slicing()
503
  image_pipe.enable_vae_tiling()
504
 
505
- pegasus_tokenizer = PegasusTokenizer.from_pretrained("google/pegasus-xsum")
506
- pegasus_model = PegasusForConditionalGeneration.from_pretrained("google/pegasus-xsum").to(device)
507
 
508
  # functionality
509
 
@@ -632,7 +632,7 @@ def handle_generation(artist,song,genre,lyrics):
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 }.'
638
 
 
31
  from safetensors.torch import load_file, save_file
32
  from diffusers import FluxPipeline
33
  from PIL import Image, ImageDraw, ImageFont
34
+ from transformers import PegasusForConditionalGeneration, PegasusTokenizerFast
35
  from refiners.fluxion.utils import manual_seed
36
  from refiners.foundationals.latent_diffusion import Solver, solvers
37
  from refiners.foundationals.latent_diffusion.stable_diffusion_1.multi_upscaler import (
 
502
  image_pipe.enable_vae_slicing()
503
  image_pipe.enable_vae_tiling()
504
 
505
+ pegasus_tokenizer = PegasusTokenizerFast.from_pretrained("google/pegasus-xsum")
506
+ pegasus_model = PegasusForConditionalGeneration.from_pretrained("google/pegasus-xsum")
507
 
508
  # functionality
509
 
 
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"Sexuality, Humans, 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 }.'
638