Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -191,7 +191,7 @@ 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 |
-
return seq.split()[0], " ".join(seq.split()[1
|
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 |
+
return seq.split("because")[0].strip(), "because " + " ".join(seq.split("because")[-1].strip()), Image.fromarray(attention_map)
|
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")]
|