Spaces:
Sleeping
Sleeping
Update generic.py
Browse files- generic.py +2 -1
generic.py
CHANGED
@@ -118,10 +118,11 @@ def save_image_vis(image_file_path, question):
|
|
118 |
# img = Image.fromarray(np.uint8(img)).convert('RGB')
|
119 |
cv2.imwrite(
|
120 |
'lxmert/lxmert/experiments/paper/new.jpg', img)
|
|
|
121 |
text_scores = (text_scores - text_scores.min()) / (text_scores.max() - text_scores.min())
|
122 |
vis_data_records = [visualization.VisualizationDataRecord(text_scores, 0, 0, 0, 0, 0, model_lrp.question_tokens, 1)]
|
123 |
html1 = visualization.visualize_text(vis_data_records)
|
124 |
-
return html1.data
|
125 |
|
126 |
|
127 |
|
|
|
118 |
# img = Image.fromarray(np.uint8(img)).convert('RGB')
|
119 |
cv2.imwrite(
|
120 |
'lxmert/lxmert/experiments/paper/new.jpg', img)
|
121 |
+
img = Image.open('lxmert/lxmert/experiments/paper/new.jpg')
|
122 |
text_scores = (text_scores - text_scores.min()) / (text_scores.max() - text_scores.min())
|
123 |
vis_data_records = [visualization.VisualizationDataRecord(text_scores, 0, 0, 0, 0, 0, model_lrp.question_tokens, 1)]
|
124 |
html1 = visualization.visualize_text(vis_data_records)
|
125 |
+
return img, html1.data
|
126 |
|
127 |
|
128 |
|