Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -906,7 +906,14 @@ async def natural_language_visualization(
|
|
906 |
ax=ax
|
907 |
)
|
908 |
# Add other chart types as needed...
|
909 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
ax.set_title(vis_request.title)
|
911 |
buf = BytesIO()
|
912 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
@@ -921,6 +928,7 @@ async def natural_language_visualization(
|
|
921 |
"x_column": vis_request.x_column,
|
922 |
"y_column": vis_request.y_column,
|
923 |
"hue_column": vis_request.hue_column
|
|
|
924 |
}
|
925 |
|
926 |
except Exception as e:
|
|
|
906 |
ax=ax
|
907 |
)
|
908 |
# Add other chart types as needed...
|
909 |
+
buf = BytesIO()
|
910 |
+
plt.savefig(buf, format='png', bbox_inches='tight')
|
911 |
+
plt.close(fig)
|
912 |
+
buf.seek(0)
|
913 |
+
|
914 |
+
# Encode without newlines
|
915 |
+
image_base64 = base64.b64encode(buf.read()).decode('utf-8')
|
916 |
+
|
917 |
ax.set_title(vis_request.title)
|
918 |
buf = BytesIO()
|
919 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
|
|
928 |
"x_column": vis_request.x_column,
|
929 |
"y_column": vis_request.y_column,
|
930 |
"hue_column": vis_request.hue_column
|
931 |
+
"code": generated_code
|
932 |
}
|
933 |
|
934 |
except Exception as e:
|