Skip to content

Commit e389a8c

Browse files
authored
Merge pull request #34 from Axiomatic-AI/errors_fixed
errors fixed
2 parents 9786433 + 612045b commit e389a8c

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

src/axiomatic/axtract/axtract_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def create_report(report_data: EquationExtractionResponse, report_path: str = ".
248248
html_content += f"""
249249
<tr>
250250
<td>\\({symbol.key}\\)</td>
251-
<td>{symbol.key}</td>
251+
<td>{symbol.value}</td>
252252
</tr>
253253
"""
254254

src/axiomatic/axtract/interactive_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,6 @@ def _create_variable_dict(equation_response: EquationExtractionResponse) -> dict
409409
for symbol in equation.latex_symbols:
410410
# Only add if not already present (avoid duplicates)
411411
if symbol.key not in variable_dict:
412-
variable_dict[symbol.key] = {"name": symbol.key}
412+
variable_dict[symbol.key] = {"name": symbol.value}
413413

414414
return variable_dict

src/axiomatic/base_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from .fso.client import AsyncFsoClient
2828
from .pic.client import AsyncPicClient
2929

30-
3130
class BaseClient:
3231
"""
3332
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

src/axiomatic/client.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import base64
22
import dill # type: ignore
33
import json
4-
import requests
4+
import requests # type: ignore
55
import os
66
import time
77
import json
@@ -42,24 +42,29 @@ def analyze_equations(
4242
file_path: Optional[str] = None,
4343
url_path: Optional[str] = None,
4444
parsed_paper: Optional[ParseResponse] = None,
45-
) -> Optional[EquationExtractionResponse]:
46-
response: Union[EquationExtractionResponse, EquationProcessingResponse]
47-
45+
) -> Optional[EquationExtractionResponse]:
4846
if file_path:
49-
with open(file_path, "rb") as file:
50-
response = self._ax_client.document.equation.from_pdf(document=file)
47+
with open(file_path, "rb") as pdf_file:
48+
response = self._ax_client.document.equation.from_pdf(document=pdf_file)
49+
5150
elif url_path:
5251
if "arxiv" in url_path and "abs" in url_path:
5352
url_path = url_path.replace("abs", "pdf")
54-
55-
response = self._ax_client.document.equation.from_pdf(document=url_path)
53+
url_file = requests.get(url_path)
54+
from io import BytesIO
55+
pdf_stream = BytesIO(url_file.content)
56+
response = self._ax_client.document.equation.from_pdf(document=pdf_stream)
57+
5658
elif parsed_paper:
57-
response = self._ax_client.document.equation.process(**parsed_paper.model_dump())
59+
response = EquationExtractionResponse.model_validate(
60+
self._ax_client.document.equation.process(**parsed_paper.model_dump()).model_dump()
61+
)
62+
5863
else:
5964
print("Please provide either a file path or a URL to analyze.")
6065
return None
61-
62-
return EquationExtractionResponse(equations=response.equations)
66+
67+
return response
6368

6469
def validate_equations(
6570
self,

0 commit comments

Comments
 (0)