@@ -54,7 +54,7 @@ async def layout_analysis(req: func.HttpRequest) -> func.HttpResponse:
54
54
55
55
56
56
@app .route (route = "figure_analysis" , methods = [func .HttpMethod .POST ])
57
- async def main (req : func .HttpRequest ) -> func .HttpResponse :
57
+ async def figure_analysis (req : func .HttpRequest ) -> func .HttpResponse :
58
58
try :
59
59
req_body = req .get_json ()
60
60
values = req_body .get ("values" )
@@ -67,10 +67,12 @@ async def main(req: func.HttpRequest) -> func.HttpResponse:
67
67
68
68
record_tasks = []
69
69
70
- figure_analysis = FigureAnalysis ()
70
+ figure_analysis_processor = FigureAnalysis ()
71
71
72
72
for value in values :
73
- record_tasks .append (asyncio .create_task (figure_analysis .analyse (value )))
73
+ record_tasks .append (
74
+ asyncio .create_task (figure_analysis_processor .analyse (value ))
75
+ )
74
76
75
77
results = await asyncio .gather (* record_tasks )
76
78
logging .info ("Results: %s" , results )
@@ -96,11 +98,11 @@ async def layout_and_figure_merger(req: func.HttpRequest) -> func.HttpResponse:
96
98
97
99
record_tasks = []
98
100
99
- layout_and_figure_merger = LayoutAndFigureMerger ()
101
+ layout_and_figure_merger_processor = LayoutAndFigureMerger ()
100
102
101
103
for value in values :
102
104
record_tasks .append (
103
- asyncio .create_task (layout_and_figure_merger .merge (value ))
105
+ asyncio .create_task (layout_and_figure_merger_processor .merge (value ))
104
106
)
105
107
106
108
results = await asyncio .gather (* record_tasks )
@@ -136,10 +138,12 @@ async def mark_up_cleaner(req: func.HttpRequest) -> func.HttpResponse:
136
138
137
139
record_tasks = []
138
140
139
- mark_up_cleaner = MarkUpCleaner ()
141
+ mark_up_cleaner_processor = MarkUpCleaner ()
140
142
141
143
for value in values :
142
- record_tasks .append (asyncio .create_task (mark_up_cleaner .clean (value )))
144
+ record_tasks .append (
145
+ asyncio .create_task (mark_up_cleaner_processor .clean (value ))
146
+ )
143
147
144
148
results = await asyncio .gather (* record_tasks )
145
149
logging .debug ("Results: %s" , results )
@@ -185,7 +189,7 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
185
189
186
190
record_tasks = []
187
191
188
- semantic_text_chunker = SemanticTextChunker (
192
+ semantic_text_chunker_processor = SemanticTextChunker (
189
193
num_surrounding_sentences = num_surrounding_sentences ,
190
194
similarity_threshold = similarity_threshold ,
191
195
max_chunk_tokens = max_chunk_tokens ,
@@ -195,7 +199,9 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
195
199
for value in values :
196
200
record_tasks .append (
197
201
asyncio .create_task (
198
- process_semantic_text_chunker (value , semantic_text_chunker )
202
+ process_semantic_text_chunker (
203
+ value , semantic_text_chunker_processor
204
+ )
199
205
)
200
206
)
201
207
@@ -204,5 +210,5 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
204
210
cleaned_tasks = {"values" : results }
205
211
206
212
return func .HttpResponse (
207
- json .dump (cleaned_tasks ), status_code = 200 , mimetype = "application/json"
213
+ json .dumps (cleaned_tasks ), status_code = 200 , mimetype = "application/json"
208
214
)
0 commit comments