Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
from diffusers import DiffusionPipeline
|
4 |
from datasets import load_dataset
|
5 |
from PIL import Image
|
@@ -17,43 +18,29 @@ pipe = pipe.to(device)
|
|
17 |
dataset = load_dataset("LEIDIA/Data_Womleimg")
|
18 |
|
19 |
|
|
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
"
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
"
|
41 |
-
"Images/Image19.jpg,a brunette girl wearing a black leather top and matching black leather pants with a decorative button on the waist. It presented in a stylish, modern pose against a gray background",
|
42 |
-
"Images/Image20.jpg,a young asian woman standing inside a subway car or train. She is leaning on one of the vertical poles of the car, with her arms crossed. The woman is dressed in a white short-sleeved t-shirt and a black leather shorts. Her hair is long and dark, and she appears to be looking to the side, with a serious or thoughtful expression.",
|
43 |
-
"Images/Image21.jpg,a young asian woman in a subway or train environment. She is standing near the carriage doors, with one hand resting on her hip and the other at her side. The woman is dressed in a tight white tank top and black leather pants. Her hair is long, straight and dark, and she is looking directly at the camera with a serious expression.",
|
44 |
-
"Images/Image22.jpg,a young brunette woman posing with her back to the camera, with her face turned to the side. She is dressed in a black leather top and tight black leather pants, as well as black leather gloves. His hair is long and wavy, with light highlights.The pose and outfit suggest a sensual and modern style, possibly for a fashion photo shoot or a themed shoot.",
|
45 |
-
"Images/Image23.jpg,The image shows a part of a woman body, specifically the butt region and part of the thighs. The woman is wearing a white thigh leather pants. The outfit has a cut that highlights the curves of the body and includes a wide belt at the waist with metallic details.The background of the image is neutral and blurred, which helps to highlight the clothing and body shape, The lighting is soft and even, enhancing the texture and shine of the clothing material. The pose and choice of clothing suggest a modern and sensual style, possibly for a fashion photo shoot or a themed shoot.The image focuses on the silhouette and curves of the body, highlighting the model clothes and physical shape.",
|
46 |
-
"Images/Image24.jpg,This image shows a part of a woman body, specifically the butt region and part of the thighs,seen from the side.The woman is wearing a white tight leather pants,The clothing has visible seams that highlight the body curves.The belt at the waist is wide and has metallic details, including a small clasp or button. The background of the image is neutral and blurred, which helps to highlight the clothing and body shape. The lighting is soft and even, enhancing the texture and shine of the clothing material.The image focuses on the silhouette and curves of the body, highlighting the model clothes and physical shape. The choice of material and design of the clothing, combined with the model pose, conveys a feeling of elegance and sophistication.",
|
47 |
-
"Images/Image25.jpg,shows a woman lower body seen from behind, a beautiful butt in shape,She is wearing a tight white leather pants that highlights your curves,The outfit has visible seams and a wide belt at the waist. The background is neutral and blurred, highlighting the woman silhouette.",
|
48 |
-
"Images/Image26.jpg,a woman from behind, dressed in a tight-fitting outfit made of gray leather clothes, The outfit includes details that resemble armor, such as shoulder pads and a wide belt with a buckle. The woman hair is tied up in a high ponytail, and she is looking to the side. The background is neutral and blurred, highlighting the woman figure.",
|
49 |
-
"Images/Image27.jpg,a woman sitting in a chair, dressed in a black blazer and purple leather pants, She is wearing black high-heeled leather boots and a black choker. Her hair is blonde and wavy, and she is looking directly into the camera. The background is neutral and blurred, highlighting the woman figure.",
|
50 |
-
"Images/Image28.jpg,a woman posing on an urban street. She is dressed in a black leather jacket, black leather pants, and tall boots with buckle details. Her hair is blonde and wavy curly, and she wears a light-colored T-shirt under her jacket. The background includes a wooden door and a stone wall, suggesting an urban and historic environment.,"
|
51 |
-
"Images/Image29.jpg,a blonde woman wearing a black leather zip-up jacket and tight black leather pants. She is posing with one hand on her hip and the other holding the zipper of her jacket. The background is a textured wall, and the lighting highlights the woman outfit and confident pose.",
|
52 |
-
"Images/Image30.jpg,a blonde woman dressed in a black leather jacket, tight black leather pants, and thigh-high boots. She is standing with her legs apart and one hand on her waist, in a confident pose. The background appears to be a photography studio with concrete walls and visible equipment.",
|
53 |
-
"Images/Image31.jpg,a blonde woman standing, dressed in a black leather jacket and tight black leather pants. The jacket has zippers and metallic details, and the woman has one hand in her pocket and the other at her side. She has blonde, wavy hair, and is looking directly at the camera with a confident expression. The background is neutral and blurred, highlighting the woman figure.",
|
54 |
-
"Images/Image32.jpg,a woman standing, dressed in a long red leather coat, a short black leather skirt, black high boots and a black turtleneck. She is holding a black bag and posing with one hand on her hip. The background is neutral with red curtains, highlighting the woman and her clothes.",
|
55 |
-
"Images/Image33.jpg,a woman on an urban street. She is wearing a red leather coat open, revealing a top that exposes her abdomen, and a short dark red leather shorts. Her hair is long and loose, and she is wearing red lipstick. The background shows a busy street with blurred shops and people."
|
56 |
-
]
|
57 |
|
58 |
|
59 |
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
import json
|
4 |
from diffusers import DiffusionPipeline
|
5 |
from datasets import load_dataset
|
6 |
from PIL import Image
|
|
|
18 |
dataset = load_dataset("LEIDIA/Data_Womleimg")
|
19 |
|
20 |
|
21 |
+
# Carrega o dataset de imagens
|
22 |
+
dataset = load_dataset("LEIDIA/Data_Womleimg", split="train")
|
23 |
|
24 |
+
# Acessando as descrições
|
25 |
+
for example in dataset:
|
26 |
+
image_id = example["image"].filename
|
27 |
+
description = example["descricoes"] # Acessando a nova feature
|
28 |
+
print(f"ID da imagem: {image_id}, Descrição: {description}")
|
29 |
+
|
30 |
+
# Cria um dicionário para mapear IDs de imagem às descrições
|
31 |
+
descriptions = {item['image_id']: item['description'] for item in descricoes_json}
|
32 |
+
|
33 |
+
# Adiciona as descrições ao dataset
|
34 |
+
dataset = dataset.map(lambda example: {'description': descriptions.get(example['image'], '')})
|
35 |
+
|
36 |
+
# Agora você pode acessar as descrições usando dataset[i]['description']
|
37 |
+
|
38 |
+
# Imprime algumas amostras com as descrições
|
39 |
+
for i in range(5): # Imprime as primeiras 5 amostras
|
40 |
+
example = dataset[i]
|
41 |
+
print(f"Descrição: {example['description']}")
|
42 |
+
else:
|
43 |
+
print("Dataset checksums not found, are not in the expected format, or empty. Skipping description loading.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
46 |
|