File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,6 @@ def save_custom_presets(custom_data, file_path):
141141 # 4) Load custom presets from JSON (if any) and integrate them
142142 # ---------------------------------------------------------------
143143 variable_dict = _create_variable_dict (loaded_equations )
144- print (variable_dict )
145144 custom_presets = load_custom_presets (file_path )
146145
147146 for custom_name , values_dict in custom_presets .items ():
@@ -151,7 +150,6 @@ def save_custom_presets(custom_data, file_path):
151150 # 5) For the "Add Requirement" dropdown
152151 # ---------------------------------------------------------------
153152 variable_names = [details ["name" ] for details in variable_dict .values ()]
154- print (variable_dict )
155153
156154 # This dict will store the final user inputs after pressing "Submit"
157155 result = {}
Original file line number Diff line number Diff line change @@ -42,19 +42,23 @@ def analyze_equations(
4242 file_path : Optional [str ] = None ,
4343 url_path : Optional [str ] = None ,
4444 parsed_paper : Optional [ParseResponse ] = None ,
45- ):
45+ ) -> Optional [ EquationExtractionResponse ] :
4646 if file_path :
4747 with open (file_path , "rb" ) as file :
4848 response = self ._ax_client .document .equation .from_pdf (document = file )
4949
5050 elif url_path :
5151 if "arxiv" in url_path and "abs" in url_path :
5252 url_path = url_path .replace ("abs" , "pdf" )
53- file = requests .get (url_path )
54- response = self ._ax_client .document .equation .from_pdf (document = file .content )
53+ response = requests .get (url_path )
54+ from io import BytesIO
55+ pdf_content = BytesIO (response .content )
56+ response = self ._ax_client .document .equation .from_pdf (document = pdf_content )
5557
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+ )
5862
5963 else :
6064 print ("Please provide either a file path or a URL to analyze." )
You can’t perform that action at this time.
0 commit comments