Download functions/chart_functions.py from nolanzandi/virtual-data-analyst: direct link, hf CLI and curl.
- Browser
- Download file 684 Bytes
-
https://huggingface.co/spaces/nolanzandi/virtual-data-analyst/resolve/refs%2Fpr%2F7/functions/chart_functions.py
- Command line
-
hf download hf://spaces/nolanzandi/virtual-data-analyst@refs/pr/7/functions/chart_functions.py
-
curl -L -o chart_functions.py https://huggingface.co/spaces/nolanzandi/virtual-data-analyst/resolve/refs%2Fpr%2F7/functions/chart_functions.py
684 Bytes
| from typing import List | |
| from haystack import component | |
| import pandas as pd | |
| from quickchart import QuickChart | |
| import json | |
| import ast | |
| def chart_generation_func(queries: List[str], session_hash): | |
| print("CHART GENERATION") | |
| query_dict = queries[0] | |
| print(query_dict) | |
| qc = QuickChart() | |
| qc.width = 1000 | |
| qc.height = 500 | |
| # Config can be set as a string or as a nested dict | |
| qc.config = query_dict | |
| # You can get the chart URL... | |
| iframe = '<iframe\n scrolling="yes"\n width="1000px"\n height="500px"\n src="' + qc.get_url() + '"\n frameborder="0"\n allowfullscreen\n></iframe>\n' | |
| return {"reply": iframe} | |