Spaces:
Sleeping
Sleeping
Upload modrag_molecule_functions.py
Browse files
modrag_molecule_functions.py
CHANGED
|
@@ -174,8 +174,12 @@ def structure_node(smiles_list: list[str]) -> (list[str], str, list):
|
|
| 174 |
img = Draw.MolsToGridImage(all_mols, molsPerRow=3, subImgSize=(250, 250))
|
| 175 |
|
| 176 |
#save the image as current_image.png
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
| 180 |
img = Image.open('current_image.png')
|
|
|
|
| 181 |
return all_structures, output_string, img
|
|
|
|
| 174 |
img = Draw.MolsToGridImage(all_mols, molsPerRow=3, subImgSize=(250, 250))
|
| 175 |
|
| 176 |
#save the image as current_image.png
|
| 177 |
+
try:
|
| 178 |
+
img.save('current_image.png')
|
| 179 |
+
except:
|
| 180 |
+
pic = img.data
|
| 181 |
+
with open('current_image.png', 'wb') as f:
|
| 182 |
+
f.write(pic)
|
| 183 |
img = Image.open('current_image.png')
|
| 184 |
+
|
| 185 |
return all_structures, output_string, img
|