Spaces:
Running
Running
Download resource_loader/json_loader.py from SAAZIZI/SummarizeAV: direct link, hf CLI and curl.
- Browser
- Download file 320 Bytes
-
https://huggingface.co/spaces/SAAZIZI/SummarizeAV/resolve/main/resource_loader/json_loader.py
- Command line
-
hf download hf://spaces/SAAZIZI/SummarizeAV/resource_loader/json_loader.py
-
curl -L -o json_loader.py https://huggingface.co/spaces/SAAZIZI/SummarizeAV/resolve/main/resource_loader/json_loader.py
320 Bytes
| import json | |
| from llama_index.schema import Document | |
| def load_json_file_and_extract_text(json_file_path): | |
| documents = [] | |
| with open(json_file_path, "r") as json_file: | |
| json_data = json.load(json_file) | |
| documents.append(Document(doc_id=json_file_path, text=json_data["text"])) | |
| return documents | |