Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -191,7 +191,8 @@ def inference(raw_image, question):
|
|
191 |
mask = last_am[0, :].reshape(14,14).cpu().numpy()
|
192 |
mask = cv2.resize(mask / mask.max(), oimg.size)[..., np.newaxis]
|
193 |
attention_map = (mask * oimg).astype("uint8")
|
194 |
-
|
|
|
195 |
|
196 |
inputs = [gr.inputs.Image(type='pil', label="Load the image of your interest"), gr.inputs.Textbox(label="Ask a question on this image")]
|
197 |
outputs = [gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Textual Explanation"), gr.outputs.Image(type='pil', label="Visual Explanation")]
|
|
|
191 |
mask = last_am[0, :].reshape(14,14).cpu().numpy()
|
192 |
mask = cv2.resize(mask / mask.max(), oimg.size)[..., np.newaxis]
|
193 |
attention_map = (mask * oimg).astype("uint8")
|
194 |
+
splitted_seq = seq.split("because")
|
195 |
+
return splitted_seq[0].strip(), "because " + " ".join(splitted_seq[-1].strip()), Image.fromarray(attention_map)
|
196 |
|
197 |
inputs = [gr.inputs.Image(type='pil', label="Load the image of your interest"), gr.inputs.Textbox(label="Ask a question on this image")]
|
198 |
outputs = [gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Textual Explanation"), gr.outputs.Image(type='pil', label="Visual Explanation")]
|