Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/axiomatic/axtract/axtract_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def create_report(report_data: EquationExtractionResponse, report_path: str = ".
html_content += f"""
<tr>
<td>\\({symbol.key}\\)</td>
<td>{symbol.key}</td>
<td>{symbol.value}</td>
</tr>
"""

Expand Down
2 changes: 1 addition & 1 deletion src/axiomatic/axtract/interactive_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,6 @@ def _create_variable_dict(equation_response: EquationExtractionResponse) -> dict
for symbol in equation.latex_symbols:
# Only add if not already present (avoid duplicates)
if symbol.key not in variable_dict:
variable_dict[symbol.key] = {"name": symbol.key}
variable_dict[symbol.key] = {"name": symbol.value}

return variable_dict
1 change: 0 additions & 1 deletion src/axiomatic/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from .fso.client import AsyncFsoClient
from .pic.client import AsyncPicClient


class BaseClient:
"""
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.
Expand Down
27 changes: 16 additions & 11 deletions src/axiomatic/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import base64
import dill # type: ignore
import json
import requests
import requests # type: ignore
import os
import time
import json
Expand Down Expand Up @@ -42,24 +42,29 @@ def analyze_equations(
file_path: Optional[str] = None,
url_path: Optional[str] = None,
parsed_paper: Optional[ParseResponse] = None,
) -> Optional[EquationExtractionResponse]:
response: Union[EquationExtractionResponse, EquationProcessingResponse]

) -> Optional[EquationExtractionResponse]:
if file_path:
with open(file_path, "rb") as file:
response = self._ax_client.document.equation.from_pdf(document=file)
with open(file_path, "rb") as pdf_file:
response = self._ax_client.document.equation.from_pdf(document=pdf_file)

elif url_path:
if "arxiv" in url_path and "abs" in url_path:
url_path = url_path.replace("abs", "pdf")

response = self._ax_client.document.equation.from_pdf(document=url_path)
url_file = requests.get(url_path)
from io import BytesIO
pdf_stream = BytesIO(url_file.content)
response = self._ax_client.document.equation.from_pdf(document=pdf_stream)

elif parsed_paper:
response = self._ax_client.document.equation.process(**parsed_paper.model_dump())
response = EquationExtractionResponse.model_validate(
self._ax_client.document.equation.process(**parsed_paper.model_dump()).model_dump()
)

else:
print("Please provide either a file path or a URL to analyze.")
return None

return EquationExtractionResponse(equations=response.equations)
return response

def validate_equations(
self,
Expand Down
Loading