Fiqa commited on
Commit
0276b97
·
verified ·
1 Parent(s): 8882a97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -33,6 +33,17 @@ def generate_caption_and_image(image):
33
  img = image.convert("RGB")
34
  # reader = easyocr.Reader(['en'])
35
  # result = reader.readtext(img)
 
 
 
 
 
 
 
 
 
 
 
36
 
37
 
38
 
@@ -44,7 +55,8 @@ def generate_caption_and_image(image):
44
  inputs = {key: val.to(device) for key, val in inputs.items()}
45
  out = model.generate(**inputs)
46
  caption = processor.decode(out[0], skip_special_tokens=True)
47
- prompt = f"Create a highly realistic design of a clothing item based on the following description: 'The design should he realted to following {caption}. The clothing should look realistic, modern, and stylish. Use high-quality fabric textures and realistic lighting to give the design a lifelike appearance. The colors, patterns, and materials should reflect the essence of the caption and extracted text.'"
 
48
 
49
 
50
  # Generate image based on the caption
 
33
  img = image.convert("RGB")
34
  # reader = easyocr.Reader(['en'])
35
  # result = reader.readtext(img)
36
+ import random
37
+
38
+ # Define lists for the three variables
39
+ fabrics = ['cotton', 'silk', 'denim', 'linen', 'polyester', 'wool', 'velvet']
40
+ patterns = ['striped', 'floral', 'geometric', 'abstract', 'solid', 'polka dots']
41
+ textile_designs = ['woven texture', 'embroidery', 'printed fabric', 'hand-dyed', 'quilting']
42
+
43
+ # Randomly select one from each category
44
+ selected_fabric = random.choice(fabrics)
45
+ selected_pattern = random.choice(patterns)
46
+ selected_textile_design = random.choice(textile_designs)
47
 
48
 
49
 
 
55
  inputs = {key: val.to(device) for key, val in inputs.items()}
56
  out = model.generate(**inputs)
57
  caption = processor.decode(out[0], skip_special_tokens=True)
58
+ prompt = f"Create a highly realistic design of a clothing item based on the following description: The design should reflect {caption}, featuring a highly realistic and modern piece of clothing that incorporates stylish and high-quality textures, exuding sophistication with realistic fabric lighting and fine details, subtly hinting at {selected_fabric}, with a {selected_pattern} motif and a {selected_textile_design} style.'''
59
+ "
60
 
61
 
62
  # Generate image based on the caption