Spaces:
Sleeping
Sleeping
Mustehson
commited on
Commit
·
476f578
1
Parent(s):
28623de
Edit Prompt
Browse files
app.py
CHANGED
@@ -49,21 +49,33 @@ def get_table_schema(table):
|
|
49 |
ddl_create = ddl_create.replace(old_path, full_path)
|
50 |
return ddl_create, full_path
|
51 |
|
|
|
52 |
def get_visualization(question, tool):
|
53 |
agent = ReactCodeAgent(tools=[tool], llm_engine=llm_engine, add_base_tools=True,
|
54 |
additional_authorized_imports=['matplotlib.pyplot',
|
55 |
'pandas', 'plotly.express',
|
56 |
-
'seaborn'], max_iterations=
|
57 |
fig = agent.run(
|
|
|
58 |
task=f'''
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
''',
|
65 |
)
|
66 |
-
|
67 |
return fig
|
68 |
|
69 |
|
|
|
49 |
ddl_create = ddl_create.replace(old_path, full_path)
|
50 |
return ddl_create, full_path
|
51 |
|
52 |
+
|
53 |
def get_visualization(question, tool):
|
54 |
agent = ReactCodeAgent(tools=[tool], llm_engine=llm_engine, add_base_tools=True,
|
55 |
additional_authorized_imports=['matplotlib.pyplot',
|
56 |
'pandas', 'plotly.express',
|
57 |
+
'seaborn'], max_iterations=10)
|
58 |
fig = agent.run(
|
59 |
+
|
60 |
task=f'''
|
61 |
+
Here are the steps you should follow while writing code for Visualization:
|
62 |
+
1. Select the most effective visualization type for the data and purpose.
|
63 |
+
2. Ensure clear and appropriate labels, colors, and design elements, keeping visual elements legible and uncluttered.
|
64 |
+
3. Follow best practices, avoiding unnecessary visual distractions (chartjunk).
|
65 |
+
4. Ensure the code is error-free, with correct fields, transformations, and aesthetics.
|
66 |
+
5. Use descriptive and accurate x and y axis labels that reflect the data.
|
67 |
+
6. Ensure units of measurement are clearly indicated on axes (e.g., %, $, cm).
|
68 |
+
7. Ensure that categorical data is plotted on one axis and numerical data on the other, with appropriate labels that clearly represent the data being visualized.
|
69 |
+
8. When plotting categorical data, arrange categories in a meaningful order (e.g., by size, time, or frequency) rather than randomly.
|
70 |
+
9. Ensure that the categorical data are plotted on the x-axis, and the frequencies (numerical data) are plotted on the y-axis.
|
71 |
+
9. Use seaborn
|
72 |
+
10. In the end you have to return a final fig using the `final_answer` tool.
|
73 |
+
|
74 |
+
Here is the task:
|
75 |
+
task: {question}
|
76 |
''',
|
77 |
)
|
78 |
+
|
79 |
return fig
|
80 |
|
81 |
|