yaron123 commited on
Commit
537f274
·
1 Parent(s): ec48f2e
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -413,8 +413,7 @@ CHECKPOINTS = ESRGANUpscalerCheckpoints(
413
 
414
  device = DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
415
  DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float32
416
- enhancer = ESRGANUpscaler(checkpoints=CHECKPOINTS, device=DEVICE, dtype=DTYPE)
417
- enhancer.to(device=DEVICE, dtype=DTYPE)
418
 
419
  # logging
420
 
@@ -435,8 +434,8 @@ pegasus_name = "google/pegasus-xsum"
435
  # precision data
436
 
437
  seq=512
438
- width=768
439
- height=768
440
  image_steps=8
441
  img_accu=0
442
 
@@ -511,7 +510,6 @@ pegasus_model = PegasusForConditionalGeneration.from_pretrained("google/pegasus-
511
 
512
  # functionality
513
 
514
- @spaces.GPU(duration=180)
515
  def upscaler(
516
  input_image: Image.Image,
517
  prompt: str = "Best-Quality Realistic Genuine Reasonable Highly-Detailed",
@@ -555,7 +553,6 @@ def upscaler(
555
 
556
  return enhanced_image
557
 
558
- @spaces.GPU(duration=180)
559
  def summarize_text(
560
  text, max_length=30, num_beams=4, early_stopping=True
561
  ):
@@ -573,7 +570,7 @@ def generate_random_string(length):
573
  characters = str(ascii_letters + digits)
574
  return ''.join(random.choice(characters) for _ in range(length))
575
 
576
- @spaces.GPU(duration=180)
577
  def pipe_generate(p1,p2):
578
  log(f'CALL pipe_generate')
579
  imgs = image_pipe(
 
413
 
414
  device = DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
415
  DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float32
416
+ enhancer = ESRGANUpscaler(checkpoints=CHECKPOINTS, device="cpu", dtype=DTYPE)
 
417
 
418
  # logging
419
 
 
434
  # precision data
435
 
436
  seq=512
437
+ width=1500
438
+ height=1500
439
  image_steps=8
440
  img_accu=0
441
 
 
510
 
511
  # functionality
512
 
 
513
  def upscaler(
514
  input_image: Image.Image,
515
  prompt: str = "Best-Quality Realistic Genuine Reasonable Highly-Detailed",
 
553
 
554
  return enhanced_image
555
 
 
556
  def summarize_text(
557
  text, max_length=30, num_beams=4, early_stopping=True
558
  ):
 
570
  characters = str(ascii_letters + digits)
571
  return ''.join(random.choice(characters) for _ in range(length))
572
 
573
+ @spaces.GPU(duration=80)
574
  def pipe_generate(p1,p2):
575
  log(f'CALL pipe_generate')
576
  imgs = image_pipe(