Spaces:
Sleeping
Sleeping
Update src/visual_insight.py
Browse files- src/visual_insight.py +19 -2
src/visual_insight.py
CHANGED
|
@@ -22,8 +22,25 @@ def call_llm(prompt):
|
|
| 22 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 23 |
|
| 24 |
visual_prompt = """
|
| 25 |
-
You are a data visualization expert
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
"""
|
| 28 |
|
| 29 |
def generate_visual_plan(column_data):
|
|
|
|
| 22 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 23 |
|
| 24 |
visual_prompt = """
|
| 25 |
+
You are a data visualization expert. You will be given a summary of a cleaned dataset.
|
| 26 |
+
Your tasks:
|
| 27 |
+
1. Suggest 3–5 interesting visualizations that would help uncover patterns or relationships.
|
| 28 |
+
2. For each, describe what insight it may reveal.
|
| 29 |
+
3. For each, write Python code using pandas/seaborn/matplotlib to generate the plot. Use 'df' as the dataframe and be precise with column names.
|
| 30 |
+
4. Always be careful and precise with column names
|
| 31 |
+
Output JSON in this exact format:
|
| 32 |
+
{
|
| 33 |
+
"visualizations": [
|
| 34 |
+
{
|
| 35 |
+
"title": "Histogram of Age",
|
| 36 |
+
"description": "Shows the distribution of age",
|
| 37 |
+
"code": "sns.histplot(df['age'], kde=True); plt.title('Age Distribution'); plt.savefig('charts/age.png'); plt.clf()"
|
| 38 |
+
},
|
| 39 |
+
...
|
| 40 |
+
]
|
| 41 |
+
}
|
| 42 |
+
Dataset Summary:
|
| 43 |
+
{column_data}
|
| 44 |
"""
|
| 45 |
|
| 46 |
def generate_visual_plan(column_data):
|