Yaron Koresh commited on
Commit
3df19d6
·
verified ·
1 Parent(s): d36d517

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -52,7 +52,6 @@ def conv_block(in_nc: int, out_nc: int) -> nn.Sequential:
52
  nn.LeakyReLU(negative_slope=0.2, inplace=True),
53
  )
54
 
55
-
56
  class ResidualDenseBlock_5C(nn.Module):
57
  """
58
  Residual Dense Block
@@ -508,7 +507,7 @@ def upscaler(
508
  prompt: str = "Photorealistic, Hyperrealistic, Realistic Photography, High-Quality Photography, Natural.",
509
  negative_prompt: str = "Distorted, Discontinuous, Blurry, Doll-Like, Overly-Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects.",
510
  seed: int = int(str(random.random()).split(".")[1]),
511
- upscale_factor: int = 4,
512
  controlnet_scale: float = 0.6,
513
  controlnet_decay: float = 1.0,
514
  condition_scale: int = 6,
@@ -547,11 +546,11 @@ def upscaler(
547
  return enhanced_image
548
 
549
  def summarize_text(
550
- text, min_length=2, max_length=8
551
  ):
552
  log(f'CALL summarize_text')
553
  summ = pipeline("summarization", model="google/pegasus-large")
554
- summary = summ("summarize: " + text, max_length=max_length, min_length=min_length, do_sample=True)[0]["summary_text"]
555
  log(f'RET summarize_text with summary as {summary}')
556
  return summary
557
 
@@ -626,7 +625,7 @@ def handle_generation(artist,song,genre,lyrics):
626
 
627
  neg = f"Sexuality, Humanity, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
628
  q = "\""
629
- pos = f'Hyperrealistic 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 }.'
630
 
631
  print(f"""
632
  Positive: {pos}
 
52
  nn.LeakyReLU(negative_slope=0.2, inplace=True),
53
  )
54
 
 
55
  class ResidualDenseBlock_5C(nn.Module):
56
  """
57
  Residual Dense Block
 
507
  prompt: str = "Photorealistic, Hyperrealistic, Realistic Photography, High-Quality Photography, Natural.",
508
  negative_prompt: str = "Distorted, Discontinuous, Blurry, Doll-Like, Overly-Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects.",
509
  seed: int = int(str(random.random()).split(".")[1]),
510
+ upscale_factor: int = 2,
511
  controlnet_scale: float = 0.6,
512
  controlnet_decay: float = 1.0,
513
  condition_scale: int = 6,
 
546
  return enhanced_image
547
 
548
  def summarize_text(
549
+ text, min_length=5, max_length=20
550
  ):
551
  log(f'CALL summarize_text')
552
  summ = pipeline("summarization", model="google/pegasus-large")
553
+ summary = summ("Summarize accurately, highlighting key information: " + text, max_length=max_length, min_length=min_length)[0]["summary_text"]
554
  log(f'RET summarize_text with summary as {summary}')
555
  return summary
556
 
 
625
 
626
  neg = f"Sexuality, Humanity, Textual, Labeled, Distorted, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
627
  q = "\""
628
+ pos = f'HQ Hyper-realistic { pos_genre } song "{ pos_song }"{ pos_lyrics_sum if pos_lyrics_sum == "" else ": " + pos_lyrics_sum }.'
629
 
630
  print(f"""
631
  Positive: {pos}