Tharunika1601 commited on
Commit
0710d1c
1 Parent(s): 1feb738

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,9 +14,9 @@ if st.button("Generate Image") and text:
14
  # Process text and get CLIP features
15
  text_features = clip_processor(text, return_tensors="pt", padding=True)
16
 
17
- # Use CLIP's image projection to generate an image representation
18
- image_representation = clip_model.get_image_features(pixel_values=text_features.pixel_values)
19
-
20
  # For visualization, you can convert the image representation back to an image
21
  image_array = image_representation.squeeze().permute(1, 2, 0).cpu().numpy()
22
  image = Image.fromarray((image_array * 255).astype('uint8'))
 
14
  # Process text and get CLIP features
15
  text_features = clip_processor(text, return_tensors="pt", padding=True)
16
 
17
+ # Use CLIP's encode_image method to obtain the image features
18
+ image_representation = clip_model.encode_image(text_features.pixel_values)
19
+
20
  # For visualization, you can convert the image representation back to an image
21
  image_array = image_representation.squeeze().permute(1, 2, 0).cpu().numpy()
22
  image = Image.fromarray((image_array * 255).astype('uint8'))