LEIDIA commited on
Commit
212a667
·
verified ·
1 Parent(s): 78451dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -40,7 +40,7 @@ dataset_descriptions = [
40
  ]
41
 
42
  # Definir parâmetros padrão para geração rápida
43
- DEFAULT_PROMPT = "A beautiful brunette woman wearing a leather outfit"
44
  DEFAULT_INFERENCE_STEPS = 6
45
  IMAGE_WIDTH = 512
46
  IMAGE_HEIGHT = 812
@@ -54,18 +54,22 @@ def resize_to_divisible_by_8(image):
54
 
55
  # Função simples para gerar imagem
56
  def infer_simple(prompt):
 
 
 
 
57
  # Geração da imagem
58
  image = pipe(
59
  prompt=prompt,
60
  num_inference_steps=DEFAULT_INFERENCE_STEPS,
61
  guidance_scale=GUIDANCE_SCALE,
62
- height=IMAGE_HEIGHT,
63
- width=IMAGE_WIDTH,
64
  ).images[0]
65
- # Redimensionar a imagem para ser divisível por 8
66
- image = resize_to_divisible_by_8(image)
67
  return image
68
 
 
69
  # Interface Gradio
70
  with gr.Blocks() as demo:
71
  with gr.Row():
 
40
  ]
41
 
42
  # Definir parâmetros padrão para geração rápida
43
+ DEFAULT_PROMPT = "A beautiful brunette woman wearing a blue leather pants "
44
  DEFAULT_INFERENCE_STEPS = 6
45
  IMAGE_WIDTH = 512
46
  IMAGE_HEIGHT = 812
 
54
 
55
  # Função simples para gerar imagem
56
  def infer_simple(prompt):
57
+ # Ajustando as dimensões para serem divisíveis por 8
58
+ adjusted_width = IMAGE_WIDTH + (8 - IMAGE_WIDTH % 8) if IMAGE_WIDTH % 8 != 0 else IMAGE_WIDTH
59
+ adjusted_height = IMAGE_HEIGHT + (8 - IMAGE_HEIGHT % 8) if IMAGE_HEIGHT % 8 != 0 else IMAGE_HEIGHT
60
+
61
  # Geração da imagem
62
  image = pipe(
63
  prompt=prompt,
64
  num_inference_steps=DEFAULT_INFERENCE_STEPS,
65
  guidance_scale=GUIDANCE_SCALE,
66
+ height=adjusted_height,
67
+ width=adjusted_width,
68
  ).images[0]
69
+
 
70
  return image
71
 
72
+
73
  # Interface Gradio
74
  with gr.Blocks() as demo:
75
  with gr.Row():