NikhilJoson commited on
Commit
dcd7638
·
verified ·
1 Parent(s): 0742eef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -40,7 +40,7 @@ def predict_clothing(images):
40
  print(type(image))
41
  inputs = processor(image, input_text, add_special_tokens=False, return_tensors="pt").to(model.device)
42
  with torch.no_grad():
43
- output = model.generate(**inputs, max_new_tokens=32)
44
 
45
 
46
  output_reponse = str(processor.decode(output[0])).split('\n')[-1]
@@ -67,7 +67,7 @@ def generate_image(category, img1, img2, img3, height, width, img_guidance_scale
67
  text = f"""The {category} in <img><|image_1|></img> wearing {dress}. The {dress} is in <img><|image_2|></img>. Ensure realistic alignment, proportions, and texture adaptation to fit the person's body shape and pose. Maintain the person's original features, such as face, hairstyle, and accessories, without distortion. Blend the clothing naturally with proper lighting and shadows to ensure photorealism. Keep the background of the first image intact."""
68
  elif len(wears)==2:
69
  topwear, bottomwear = wears[0], wears[1]
70
- text = f"""A {category} in <img><|image_1|></img> wearing {topwear} and {bottomwear}. The {topwear} is in <img><|image_2|></img>. The {bottomwear} is in <img><|image_3|></img>. Ensure realistic alignment, proportions, and texture adaptation to fit the person's body shape and pose. Maintain the person's original features, such as face, hairstyle, and accessories, without distortion. Blend the clothing naturally with proper lighting and shadows to ensure photorealism. Keep the background of the first image intact."""
71
  else:
72
  input_images = None
73
 
 
40
  print(type(image))
41
  inputs = processor(image, input_text, add_special_tokens=False, return_tensors="pt").to(model.device)
42
  with torch.no_grad():
43
+ output = model.generate(**inputs, max_new_tokens=32, temperature=0.1)
44
 
45
 
46
  output_reponse = str(processor.decode(output[0])).split('\n')[-1]
 
67
  text = f"""The {category} in <img><|image_1|></img> wearing {dress}. The {dress} is in <img><|image_2|></img>. Ensure realistic alignment, proportions, and texture adaptation to fit the person's body shape and pose. Maintain the person's original features, such as face, hairstyle, and accessories, without distortion. Blend the clothing naturally with proper lighting and shadows to ensure photorealism. Keep the background of the first image intact."""
68
  elif len(wears)==2:
69
  topwear, bottomwear = wears[0], wears[1]
70
+ text = f"""The {category} in <img><|image_1|></img> wearing {topwear} and {bottomwear}. The {topwear} is in <img><|image_2|></img>. The {bottomwear} is in <img><|image_3|></img>. Ensure realistic alignment, proportions, and texture adaptation to fit the person's body shape and pose. Maintain the person's original features, such as face, hairstyle, and accessories, without distortion. Blend the clothing naturally with proper lighting and shadows to ensure photorealism. Keep the background of the first image intact."""
71
  else:
72
  input_images = None
73