Update app.py
Browse files
app.py
CHANGED
@@ -18,27 +18,9 @@ pipe = pipe.to(device)
|
|
18 |
# Carregar o dataset do Hugging Face
|
19 |
dataset = load_dataset("LEIDIA/Data_Womleimg", split="train") # Carrega o dataset de imagens
|
20 |
|
21 |
-
# Localizar o arquivo JSON dentro do dataset
|
22 |
-
json_path = dataset["train"].cache_files[0]["filename"].replace("data.arrow", "Wom_dataset.json")
|
23 |
-
|
24 |
-
# Ler as descrições do JSON
|
25 |
-
with open(json_path, "r") as f:
|
26 |
-
descriptions = json.load(f)
|
27 |
-
|
28 |
-
# Acessando as descrições corretamente (assumindo que estejam no arquivo JSON)
|
29 |
-
for idx, item in enumerate(dataset["train"]):
|
30 |
-
image = item["image"] # A imagem
|
31 |
-
description = descriptions.get(item["id"], "Descrição não encontrada")
|
32 |
-
print(f"ID da imagem: {idx}, Descrição: {description}")
|
33 |
-
|
34 |
-
# Exibe algumas amostras com suas descrições
|
35 |
-
for i, (image_id, description) in enumerate(descriptions.items()):
|
36 |
-
if i < 5: # Limita a exibição para as primeiras 5 imagens
|
37 |
-
print(f"ID da imagem: {image_id}, Descrição: {description}")
|
38 |
-
|
39 |
|
40 |
# Definir parâmetros padrão para geração rápida
|
41 |
-
DEFAULT_PROMPT = "A beautiful brunette woman wearing a blue leather pants
|
42 |
DEFAULT_INFERENCE_STEPS = 6
|
43 |
IMAGE_WIDTH = 512
|
44 |
IMAGE_HEIGHT = 816
|
|
|
18 |
# Carregar o dataset do Hugging Face
|
19 |
dataset = load_dataset("LEIDIA/Data_Womleimg", split="train") # Carrega o dataset de imagens
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Definir parâmetros padrão para geração rápida
|
23 |
+
DEFAULT_PROMPT = "A beautiful brunette woman wearing a blue leather pants"
|
24 |
DEFAULT_INFERENCE_STEPS = 6
|
25 |
IMAGE_WIDTH = 512
|
26 |
IMAGE_HEIGHT = 816
|