Spaces:
Sleeping
Sleeping
Commit
•
0710d1c
1
Parent(s):
1feb738
Update app.py
Browse files
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
|
18 |
-
image_representation = clip_model.
|
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'))
|