Spaces:
Build error
Build error
File size: 775 Bytes
8232a70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# Function to classify response and determine visualization type
def classify_response(response_text):
"""
Uses basic keyword matching and structured extraction.
Ideally, function calling would return a JSON like: {"chart_type": "line_chart", "data": {...}}
"""
response_text = response_text.lower()
if "trend" in response_text or "growth" in response_text:
return "line_chart"
elif "comparison" in response_text or "market share" in response_text:
return "bar_chart"
elif "decision" in response_text or "strategy" in response_text:
return "decision_tree"
elif "distribution" in response_text or "proportion" in response_text:
return "pie_chart"
else:
return None # No visualization needed |