22import requests
33import os
44import time
5- from typing import Dict , List , Union , Optional
5+ from typing import Dict , List , Optional
66
77from .base_client import BaseClient , AsyncBaseClient
88from . import ParseResponse
@@ -17,6 +17,7 @@ def __init__(self, *args, **kwargs):
1717
1818 self .document_helper = DocumentHelper (self )
1919 self .tools_helper = ToolsHelper (self )
20+ self .axtract_helper = AxtractHelper (self )
2021
2122
2223class AxtractHelper :
@@ -32,26 +33,21 @@ def create_report(self, response: EquationExtractionResponse, path: str):
3233
3334 create_report (response , path )
3435
35- def analyze_equations (
36- self ,
37- file_path : Optional [str ] = None ,
38- url_path : Optional [str ] = None
39- ) -> Optional [EquationExtractionResponse ]:
36+ def analyze_equations (self , file_path : Optional [str ] = None , url_path : Optional [str ] = None ):
4037 if file_path :
4138 with open (file_path , "rb" ) as file :
4239 response = self ._ax_client .document .equation .from_pdf (document = file )
4340
4441 elif url_path :
4542 if "arxiv" in url_path and "abs" in url_path :
4643 url_path = url_path .replace ("abs" , "pdf" )
47-
48- response = self ._ax_client .document .equation .from_pdf (document = url_path )
44+ file = requests . get ( url_path )
45+ response = self ._ax_client .document .equation .from_pdf (document = file . content )
4946
5047 else :
5148 print ("Please provide either a file path or a URL to analyze." )
5249 return None
53-
54- return EquationExtractionResponse (equations = response .equations )
50+ return response
5551
5652 def validate_equations (
5753 self ,
@@ -65,12 +61,9 @@ def validate_equations(
6561
6662 api_requirements = [
6763 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
64+ symbol = req .symbol , name = req .name , value = req .value , units = req .units , tolerance = req .tolerance
65+ )
66+ for req in requirements
7467 ]
7568
7669 variable_dict = _create_variable_dict (loaded_equations )
0 commit comments