Spaces:
Runtime error
Runtime error
debugging inability to produce correct gif depending on parameters
Browse files- image_posterior.py +3 -3
image_posterior.py
CHANGED
@@ -69,15 +69,15 @@ def create_gif(explanation_blr, img_name, segments, image, n_images=20, n_max=5)
|
|
69 |
# https://stackoverflow.com/questions/61716066/creating-an-animation-out-of-matplotlib-pngs
|
70 |
print(f"Saving gif to {img_name}_explanation.gif")
|
71 |
|
72 |
-
if(os.path.exists(f'
|
73 |
-
os.remove(f'
|
74 |
|
75 |
ims = [imageio.imread(f) for f in paths]
|
76 |
imageio.mimwrite(f'{img_name}_explanation.gif', ims)
|
77 |
|
78 |
html = (
|
79 |
"<div >"
|
80 |
-
f"<img src='
|
81 |
+ "</div>"
|
82 |
)
|
83 |
return html
|
|
|
69 |
# https://stackoverflow.com/questions/61716066/creating-an-animation-out-of-matplotlib-pngs
|
70 |
print(f"Saving gif to {img_name}_explanation.gif")
|
71 |
|
72 |
+
if(os.path.exists(f'./{img_name}_explanation.gif')):
|
73 |
+
os.remove(f'./{img_name}_explanation.gif')
|
74 |
|
75 |
ims = [imageio.imread(f) for f in paths]
|
76 |
imageio.mimwrite(f'{img_name}_explanation.gif', ims)
|
77 |
|
78 |
html = (
|
79 |
"<div >"
|
80 |
+
f"<img src='./{img_name}_explanation.gif' alt='explanation gif'/>"
|
81 |
+ "</div>"
|
82 |
)
|
83 |
return html
|