LEIDIA commited on
Commit
b27eba8
·
verified ·
1 Parent(s): 3014a98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -36
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
- # Parâmetros para carregar o dataset personalizado
22
- dataset_descriptions = [
23
- "Images/Image01.jpg,A blonde woman wearing a blue leather jumpsuit with leather gloves the same color. She is standing with one hand on her face and the other on her waist, in a confident pose. The background is dark and neutral, highlighting the woman figure.",
24
- "Images/Image02.jpg,A woman standing in an urban environment, possibly a street between buildings.She is dressed in a long-sleeved white blouse and tight black leather pants, with a wide belt at her waist. She wears high black boots and has long, loose hair. The background includes buildings and a street, suggesting an urban setting",
25
- "Images/Image03.jpg,A woman legs wearing blue high leather boots with a zipper on the side and high heels.The background is a light blue color, highlighting the boots. The woman legs is standing, with slightly apart, showing her boots prominently.",
26
- "Images/Image04.jpg,A brunette woman wearing a long red leather coat combined with a leather shorts and tigh high leather boots of the same color. The coat is open, revealing the skirt and boots. The background is neutral and blurred, highlighting the woman figure.",
27
- "Images/Image05.jpg,The image shows the lower part of a woman body, seen from the side. She is wearing tight beige leather pants and black high-heeled boots. is leaning against a brick wall, and the background includes a glass door. The lighting is natural, highlighting the woman curves and clothing.",
28
- "Images/Image06.jpg,A woman in purple leather leggings with tigh high black leather boots",
29
- "Images/Image07.jpg,A woman in black leather top and a long black leather skirt",
30
- "Images/Image08.jpg,A blonde long hair curly woman using a yellow mini tight leather skirt",
31
- "Images/Image09.jpg,A thin asian woman using a thigh long black leather dress",
32
- "Images/Image10.jpg,A simple high brown leather boots",
33
- "Images/Image11.jpg,A beautiful face brunette woman using a leather clothes",
34
- "Images/Image12.jpg,A beautiful brunette woman wearing a sleeveless black dress, seated at a bar, She is holding a glass champagne, The background is softly lit, with warm lighting and blurred bottles on shelves, creating a cozy and elegant atmosphere.",
35
- "Images/Image13.jpg,A curly blonde woman is wearing a bold and stylish outfit red leather jacket paired with black leather tight pants and red high-heeled leather boots, The outfit has a modern and edgy vibe, with a focus on vibrant colors and sleek materials.",
36
- "Images/Image14.jpg,Ebony woman standing outdoors against a backdrop of rolling hills and a cloudy sky,wearing a striking outfit consisting of a red leather shirt, a black leather mini corset, and a red plaid skirt with a long panel on one side,also wearing knee-high red lace-up leather boots, Their hair is voluminous and styled in natural curls, The setting appears to be a grassy landscape.",
37
- "Images/Image15.jpg,Blonde curly woman is wearing a fitted, shiny blue outfit made of what appears to be leather or vinyl clothes, The ensemble includes a jacket and pants with metallic buttons and a belt at the waist, They are also wearing knee-high boots with lacing details, Their hair is styled in voluminous, curly blonde locks. The setting is a simple, neutral-colored room with a concrete or stone-like wall and floor.",
38
- "Images/Image16.jpg,The girl is wearing a black leather outfit include top,legging and sleeves,consisting of a fitted top with a heart-shaped cutout and high-waisted pants, The ensemble includes a purple cape and the individual has long purple hair,The style is reminiscent of superhero or fantasy attire, emphasizing a bold and sleek look.",
39
- "Images/Image17.jpg,The girl dressed in a sleek, black leather outfit. The attire includes a cropped top with a zip closure and a high-waisted bottom, both designed to accentuate the figure silhouette, The individual has long, pink hair styled in a ponytail, and is wearing long black gloves that reach the upper arms. The background appears to be softly lit, enhancing the glossy texture of the leather. The overall look is bold and fashion-forward, with a striking color contrast between the black and pink elements.",
40
- "Images/Image18.jpg,a girl wearing a form-fitting black leather top that highlights their physique, The top has a high neckline and is sleeveless, emphasizing the shoulders and arms, The individual has long, pink hair cascading down, adding a striking contrast to the outfit. The background is a light, neutral color, which helps to accentuate the subject, The overall aesthetic is bold and fashion-forward.",
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