Skip to content

Commit afa4f7d

Browse files
committed
Update
1 parent f1c6a4c commit afa4f7d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

image_processing/src/image_processing/__init__.py

Whitespace-only changes.

image_processing/src/image_processing/function_app.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def layout_analysis(req: func.HttpRequest) -> func.HttpResponse:
5454

5555

5656
@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:
5858
try:
5959
req_body = req.get_json()
6060
values = req_body.get("values")
@@ -67,10 +67,12 @@ async def main(req: func.HttpRequest) -> func.HttpResponse:
6767

6868
record_tasks = []
6969

70-
figure_analysis = FigureAnalysis()
70+
figure_analysis_processor = FigureAnalysis()
7171

7272
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+
)
7476

7577
results = await asyncio.gather(*record_tasks)
7678
logging.info("Results: %s", results)
@@ -96,11 +98,11 @@ async def layout_and_figure_merger(req: func.HttpRequest) -> func.HttpResponse:
9698

9799
record_tasks = []
98100

99-
layout_and_figure_merger = LayoutAndFigureMerger()
101+
layout_and_figure_merger_processor = LayoutAndFigureMerger()
100102

101103
for value in values:
102104
record_tasks.append(
103-
asyncio.create_task(layout_and_figure_merger.merge(value))
105+
asyncio.create_task(layout_and_figure_merger_processor.merge(value))
104106
)
105107

106108
results = await asyncio.gather(*record_tasks)
@@ -136,10 +138,12 @@ async def mark_up_cleaner(req: func.HttpRequest) -> func.HttpResponse:
136138

137139
record_tasks = []
138140

139-
mark_up_cleaner = MarkUpCleaner()
141+
mark_up_cleaner_processor = MarkUpCleaner()
140142

141143
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+
)
143147

144148
results = await asyncio.gather(*record_tasks)
145149
logging.debug("Results: %s", results)
@@ -185,7 +189,7 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
185189

186190
record_tasks = []
187191

188-
semantic_text_chunker = SemanticTextChunker(
192+
semantic_text_chunker_processor = SemanticTextChunker(
189193
num_surrounding_sentences=num_surrounding_sentences,
190194
similarity_threshold=similarity_threshold,
191195
max_chunk_tokens=max_chunk_tokens,
@@ -195,7 +199,9 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
195199
for value in values:
196200
record_tasks.append(
197201
asyncio.create_task(
198-
process_semantic_text_chunker(value, semantic_text_chunker)
202+
process_semantic_text_chunker(
203+
value, semantic_text_chunker_processor
204+
)
199205
)
200206
)
201207

@@ -204,5 +210,5 @@ async def semantic_text_chunker(req: func.HttpRequest) -> func.HttpResponse:
204210
cleaned_tasks = {"values": results}
205211

206212
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"
208214
)

0 commit comments

Comments
 (0)