fantaxy commited on
Commit
d65ad28
·
verified ·
1 Parent(s): 9e84d1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -2
app.py CHANGED
@@ -511,14 +511,34 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
511
  variant="fp16"
512
  ).to(device)
513
 
 
514
  def generate_image(prompt):
515
  # 한국어를 영어로 번역
516
  translated = translator(prompt)[0]['translation_text']
517
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  # 이미지 생성
519
- image = pipe(translated, num_inference_steps=30, guidance_scale=9).images[0]
 
 
 
 
 
 
 
 
520
 
521
- # 이미지를 PIL Image 객체로 반환
522
  return image
523
 
524
  def generate_images(blog_post):
 
511
  variant="fp16"
512
  ).to(device)
513
 
514
+
515
  def generate_image(prompt):
516
  # 한국어를 영어로 번역
517
  translated = translator(prompt)[0]['translation_text']
518
 
519
+ # Hi-res와 3840x2160 스타일 적용
520
+ enhanced_prompt = f"hyper-realistic 8K image of {translated}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic"
521
+
522
+ # 고정된 설정값
523
+ negative_prompt = "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly, (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, disgusting, amputation"
524
+ width = 512
525
+ height = 512
526
+ guidance_scale = 6
527
+ num_inference_steps = 100
528
+ seed = random.randint(0, 2**32 - 1)
529
+ generator = torch.Generator("cuda").manual_seed(seed)
530
+
531
  # 이미지 생성
532
+ image = pipe(
533
+ prompt=enhanced_prompt,
534
+ negative_prompt=negative_prompt,
535
+ width=width,
536
+ height=height,
537
+ guidance_scale=guidance_scale,
538
+ num_inference_steps=num_inference_steps,
539
+ generator=generator
540
+ ).images[0]
541
 
 
542
  return image
543
 
544
  def generate_images(blog_post):