Skip to content

Commit cd2afa4

Browse files
committed
fast processing
1 parent 25ba64e commit cd2afa4

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/axiomatic/client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ def create_report(self, response: EquationExtractionResponse, path: str):
3535
def analyze_equations(
3636
self,
3737
file_path: Optional[str] = None,
38-
url_path: Optional[str] = None
38+
url_path: Optional[str] = None,
39+
parsed_paper: Optional[ParseResponse] = None,
3940
) -> Optional[EquationExtractionResponse]:
4041
if file_path:
4142
with open(file_path, "rb") as file:
4243
response = self._ax_client.document.equation.from_pdf(document=file)
43-
4444
elif url_path:
4545
if "arxiv" in url_path and "abs" in url_path:
4646
url_path = url_path.replace("abs", "pdf")
47-
48-
response = self._ax_client.document.equation.from_pdf(document=url_path)
4947

48+
response = self._ax_client.document.equation.from_pdf(document=url_path)
49+
elif parsed_paper:
50+
response = self._ax_client.document.equation.process(**parsed_paper)
5051
else:
5152
print("Please provide either a file path or a URL to analyze.")
5253
return None
@@ -65,12 +66,9 @@ def validate_equations(
6566

6667
api_requirements = [
6768
ApiVariableRequirement(
68-
symbol=req.symbol,
69-
name=req.name,
70-
value=req.value,
71-
units=req.units,
72-
tolerance=req.tolerance
73-
) for req in requirements
69+
symbol=req.symbol, name=req.name, value=req.value, units=req.units, tolerance=req.tolerance
70+
)
71+
for req in requirements
7472
]
7573

7674
variable_dict = _create_variable_dict(loaded_equations)

0 commit comments

Comments
 (0)