Spaces:
Sleeping
Sleeping
Download config.example.py from Ray1ee01/ChartPipeline: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/spaces/Ray1ee01/ChartPipeline/resolve/main/config.example.py
- Command line
-
hf download hf://spaces/Ray1ee01/ChartPipeline/config.example.py
-
curl -L -o config.example.py https://huggingface.co/spaces/Ray1ee01/ChartPipeline/resolve/main/config.example.py
1.89 kB
| import os | |
| from pathlib import Path | |
| client_key = os.getenv("OPENAI_API_KEY", "") | |
| base_url = os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1") | |
| api_key = client_key | |
| openai_api_key = api_key | |
| topk = int(os.getenv("CHARTPIPELINE_TOPK", "5")) | |
| resource_path = os.getenv("CHARTPIPELINE_RESOURCE_PATH", str(Path("resources").resolve())) | |
| data_resource_dirs = [ | |
| path | |
| for path in os.getenv("CHARTPIPELINE_DATA_RESOURCE_DIRS", str(Path("examples").resolve())).split(os.pathsep) | |
| if path | |
| ] | |
| data_resource_path = data_resource_dirs[0] if data_resource_dirs else str(Path("examples").resolve()) | |
| color_resource_path = os.path.join(resource_path, "color") | |
| image_resource_path = os.path.join(resource_path, "image") | |
| text_resource_path = os.path.join(resource_path, "text") | |
| result_resource_path = os.path.join(resource_path, "result") | |
| text_json_path = os.path.join(text_resource_path, "training_data.json") | |
| text_index_path = os.path.join(text_resource_path, "faiss_infographics.index") | |
| text_data_path = os.path.join(text_resource_path, "infographics_data.npy") | |
| color_index_path = os.path.join(color_resource_path, "color_palette.index") | |
| color_data_path = os.path.join(color_resource_path, "color_palette.json") | |
| image_index_path = os.path.join(image_resource_path, "image_recommendation.index") | |
| image_data_path = os.path.join(image_resource_path, "image_recommendation.json") | |
| image_list_path = os.path.join(image_resource_path, "result_map.txt") | |
| model_resource_path = os.path.join(resource_path, "models") | |
| embed_model_path = os.getenv( | |
| "CHARTPIPELINE_EMBED_MODEL_PATH", | |
| os.path.join( | |
| model_resource_path, | |
| "models--sentence-transformers--all-MiniLM-L6-v2", | |
| "snapshots", | |
| "fa97f6e7cb1a59073dff9e6b13e2715cf7475ac9", | |
| ), | |
| ) | |
| sentence_transformer_path = embed_model_path | |
| RENDER_LONGEST_SIDE = int(os.getenv("CHARTPIPELINE_RENDER_LONGEST_SIDE", "3860")) | |