Skip to content

Commit 58d9488

Browse files
committed
fixed???
1 parent 62f82ba commit 58d9488

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/axiomatic/client.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import requests
33
import os
44
import time
5-
from typing import Dict
5+
from typing import Dict, List
66

77
from .base_client import BaseClient, AsyncBaseClient
88
from . import ParseResponse
@@ -32,16 +32,20 @@ def create_report(self, response: EquationExtractionResponse, path: str):
3232

3333
create_report(response, path)
3434

35-
def analyze_equations(self, file_path: str = None, url_path: str = None):
35+
def analyze_equations(
36+
self,
37+
file_path: str | None = None,
38+
url_path: str | None = None
39+
) -> EquationExtractionResponse | None:
3640
if file_path:
37-
file = open(file_path, "rb")
38-
response = self._ax_client.document.equation.from_pdf(document=file)
41+
with open(file_path, "rb") as file:
42+
response = self._ax_client.document.equation.from_pdf(document=file)
3943

4044
elif url_path:
4145
if "arxiv" in url_path and "abs" in url_path:
4246
url_path = url_path.replace("abs", "pdf")
43-
44-
response = self._ax_client.document.equation.from_pdf(document=file)
47+
48+
response = self._ax_client.document.equation.from_pdf(url=url_path)
4549

4650
else:
4751
print("Please provide either a file path or a URL to analyze.")
@@ -51,15 +55,15 @@ def analyze_equations(self, file_path: str = None, url_path: str = None):
5155

5256
def validate_equations(
5357
self,
54-
requirements: list[VariableRequirement],
58+
requirements: List[VariableRequirement],
5559
loaded_equations: EquationExtractionResponse,
5660
show_hypergraph: bool = True,
5761
):
5862
from .axtract.validation_results import display_full_results
5963
from .axtract.interactive_table import _create_variable_dict
6064

6165
variable_dict = _create_variable_dict(loaded_equations)
62-
api_response = self._ax_client.document.equation.validate(request=requirements[0])
66+
api_response = self._ax_client.document.equation.validate(request=[requirements[0]])
6367
display_full_results(api_response.model_dump(), variable_dict, show_hypergraph=show_hypergraph)
6468

6569
def set_numerical_requirements(self, extracted_equations):

0 commit comments

Comments
 (0)