Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def generate_image(story):
|
|
| 23 |
|
| 24 |
def evaluate_similarity(story, img_path="generated_image.png"):
|
| 25 |
image = clip_preprocess(Image.open(img_path)).unsqueeze(0).to(device)
|
| 26 |
-
text = clip.tokenize([story], truncate).to(device)
|
| 27 |
with torch.no_grad():
|
| 28 |
image_features = clip_model.encode_image(image)
|
| 29 |
text_features = clip_model.encode_text(text)
|
|
|
|
| 23 |
|
| 24 |
def evaluate_similarity(story, img_path="generated_image.png"):
|
| 25 |
image = clip_preprocess(Image.open(img_path)).unsqueeze(0).to(device)
|
| 26 |
+
text = clip.tokenize([story], truncate=True).to(device)
|
| 27 |
with torch.no_grad():
|
| 28 |
image_features = clip_model.encode_image(image)
|
| 29 |
text_features = clip_model.encode_text(text)
|