Spaces:
Build error
Build error
Download utils.py from ABDALLAH31/Contract_Risk_Analyzer: direct link, hf CLI and curl.
- Browser
- Download file 326 Bytes
-
https://huggingface.co/spaces/ABDALLAH31/Contract_Risk_Analyzer/resolve/main/utils.py
- Command line
-
hf download hf://spaces/ABDALLAH31/Contract_Risk_Analyzer/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/ABDALLAH31/Contract_Risk_Analyzer/resolve/main/utils.py
326 Bytes
| import pdfplumber | |
| import re | |
| 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 [s.strip() for s in re.split(r'(?<=[.?!])\s+', text) if s.strip()] | |