Yaron Koresh commited on
Commit
9835438
·
verified ·
1 Parent(s): b8ba49d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -525,8 +525,8 @@ torch.cuda.empty_cache()
525
 
526
  def upscaler(
527
  input_image: Image.Image,
528
- prompt: str = "Hyper realistic photography, Natural visual content.",
529
- negative_prompt: str = "Distorted, Discontinuous, Blurry, Doll-Like, Overly-Plastic, Low-Quality, Painted, Smoothed, Artificial, Phony, Gaudy, Digital Effects.",
530
  seed: int = random.randint(0, MAX_SEED),
531
  upscale_factor: int = 2,
532
  controlnet_scale: float = 0.6,
@@ -535,7 +535,7 @@ def upscaler(
535
  tile_width: int = 112,
536
  tile_height: int = 144,
537
  denoise_strength: float = 0.35,
538
- num_inference_steps: int = 40,
539
  solver: str = "DDIM",
540
  ) -> Image.Image:
541
 
@@ -634,15 +634,12 @@ def generate_random_string(length):
634
  def add_song_cover_text(img,top_title=None,bottom_title=None):
635
 
636
  global working
637
- global _HEIGHT_
638
- global _WIDTH_
639
 
640
  if not working:
641
 
642
  working = True
643
 
644
- h = _HEIGHT_
645
- w = _WIDTH_
646
 
647
  draw = ImageDraw.Draw(img,mode="RGBA")
648
 
@@ -1319,9 +1316,9 @@ def handle_generation(h,w,d):
1319
  d = d if d == "" else translate(d)
1320
  d = re.sub(r"([ \t]){1,}", " ", d).lower().strip()
1321
 
1322
- neg = f"Textual, Text, Distorted, Fake, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low Quality, Paint, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
1323
  q = "\""
1324
- pos = f'HQ Hyper-realistic professional photograph{ d if d == "" else ": " + d }.'
1325
 
1326
  print(f"""
1327
  Positive: {pos}
@@ -1337,7 +1334,7 @@ def handle_generation(h,w,d):
1337
  output_type="pil",
1338
  guidance_scale=img_accu,
1339
  num_images_per_prompt=1,
1340
- num_inference_steps=50,
1341
  max_sequence_length=seq,
1342
  generator=torch.Generator(device).manual_seed(random.randint(0, MAX_SEED))
1343
  ).images[0]
 
525
 
526
  def upscaler(
527
  input_image: Image.Image,
528
+ prompt: str = "Masterpiece, Best Quality, Hyper-Realistic, Super-Realistic.",
529
+ negative_prompt: str = "Blurry, Shiny, Smooth, Polished, Low Quality, Worst Quality, Normal Quality, Anime Quality, Movies Quality.",
530
  seed: int = random.randint(0, MAX_SEED),
531
  upscale_factor: int = 2,
532
  controlnet_scale: float = 0.6,
 
535
  tile_width: int = 112,
536
  tile_height: int = 144,
537
  denoise_strength: float = 0.35,
538
+ num_inference_steps: int = 30,
539
  solver: str = "DDIM",
540
  ) -> Image.Image:
541
 
 
634
  def add_song_cover_text(img,top_title=None,bottom_title=None):
635
 
636
  global working
 
 
637
 
638
  if not working:
639
 
640
  working = True
641
 
642
+ w, h = img.size
 
643
 
644
  draw = ImageDraw.Draw(img,mode="RGBA")
645
 
 
1316
  d = d if d == "" else translate(d)
1317
  d = re.sub(r"([ \t]){1,}", " ", d).lower().strip()
1318
 
1319
+ neg = f"Textual, Text, Blurry, Shiny, Smooth, Polished, Low Quality, Worst Quality, Normal Quality, Anime Quality, Movies Quality."
1320
  q = "\""
1321
+ pos = f'Masterpiece, Best Quality, Hyper-Realistic, Super-Realistic{ d if d == "" else ", " + d }'
1322
 
1323
  print(f"""
1324
  Positive: {pos}
 
1334
  output_type="pil",
1335
  guidance_scale=img_accu,
1336
  num_images_per_prompt=1,
1337
+ num_inference_steps=30,
1338
  max_sequence_length=seq,
1339
  generator=torch.Generator(device).manual_seed(random.randint(0, MAX_SEED))
1340
  ).images[0]