Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,13 @@ model_repo_id = "stabilityai/sdxl-turbo" # Continuando com o modelo especificad
|
|
11 |
|
12 |
# Carregar o pipeline configurado para CPU
|
13 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id)
|
|
|
|
|
14 |
pipe = pipe.to(device)
|
15 |
|
|
|
|
|
|
|
16 |
# Carregando o dataset do Hugging Face
|
17 |
dataset = load_dataset("LEIDIA/Data_Womleimg")
|
18 |
|
@@ -67,6 +72,13 @@ def resize_to_divisible_by_8(image):
|
|
67 |
new_height = height + (8 - height % 8) if height % 8 != 0 else height
|
68 |
return image.resize((new_width, new_height))
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
# Função simples para gerar imagem
|
71 |
def infer_simple(prompt):
|
72 |
# Geração da imagem
|
|
|
11 |
|
12 |
# Carregar o pipeline configurado para CPU
|
13 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id)
|
14 |
+
revision="fp16", # Adicione esta linha para otimização, se aplicável
|
15 |
+
)
|
16 |
pipe = pipe.to(device)
|
17 |
|
18 |
+
# Atualize as configurações do pipeline diretamente
|
19 |
+
pipe.unet.config.sample_size = (808, 512) # Ajuste de altura e largura divisíveis por 8
|
20 |
+
|
21 |
# Carregando o dataset do Hugging Face
|
22 |
dataset = load_dataset("LEIDIA/Data_Womleimg")
|
23 |
|
|
|
72 |
new_height = height + (8 - height % 8) if height % 8 != 0 else height
|
73 |
return image.resize((new_width, new_height))
|
74 |
|
75 |
+
def infer_simple(prompt):
|
76 |
+
# Garantir que as dimensões sejam divisíveis por 8 antes de gerar
|
77 |
+
adjusted_height = IMAGE_HEIGHT - (IMAGE_HEIGHT % 8)
|
78 |
+
adjusted_width = IMAGE_WIDTH - (IMAGE_WIDTH % 8)
|
79 |
+
|
80 |
+
print(f"Using height: {IMAGE_HEIGHT} and width: {IMAGE_WIDTH}")
|
81 |
+
|
82 |
# Função simples para gerar imagem
|
83 |
def infer_simple(prompt):
|
84 |
# Geração da imagem
|