Spaces:
Build error
Build error
Download utils.py from SathvikGanta/contract-risk-analyzer: direct link, hf CLI and curl.
- Browser
- Download file 315 Bytes
-
https://huggingface.co/spaces/SathvikGanta/contract-risk-analyzer/resolve/main/utils.py
- Command line
-
hf download hf://spaces/SathvikGanta/contract-risk-analyzer/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/SathvikGanta/contract-risk-analyzer/resolve/main/utils.py
315 Bytes
| import pdfplumber | |
| def extract_text_from_pdf(file_obj): | |
| text = "" | |
| with pdfplumber.open(file_obj) as pdf: | |
| for page in pdf.pages: | |
| text += page.extract_text() or "" | |
| return text | |
| def simple_clause_split(text): | |
| return [clause.strip() for clause in text.split('. ') if clause.strip()] | |