Spaces:
Sleeping
Sleeping
Victoria Shevchenko commited on
Commit ·
66935ff
1
Parent(s): 616dd97
attempt to resolve spacy issue
Browse files23 unmodified lines24252627282917 unmodified lines474849505152535423 unmodified lines"""return "What magic will you build ?"@tooldef extract_text_from_pdf(pdf_path: str) -> str:"""A tool that extracts text from a PDF file.17 unmodified linestext: A string representing the text to extract entities from.desired_entities: A list of entities the user needs to be extracted."""command = ["python -m", "spacy download en_core_web_lg"]subprocess.run(command, capture_output=True, text=True)nlp = spacy.load("en_core_web_sm")doc = nlp(text)23 unmodified lines2425262728293031323334353617 unmodified lines5455565758596023 unmodified lines"""return "What magic will you build ?"def download_spacy_model():try:subprocess.run(["python", "-m", "spacy", "download", "en_core_web_lg"], check=True)print("spaCy model downloaded successfully.")except subprocess.CalledProcessError as e:print(f"Error downloading spaCy model: {e}")@tooldef extract_text_from_pdf(pdf_path: str) -> str:"""A tool that extracts text from a PDF file.17 unmodified linestext: A string representing the text to extract entities from.desired_entities: A list of entities the user needs to be extracted."""download_spacy_model()nlp = spacy.load("en_core_web_sm")doc = nlp(text)
app.py+8-2