Skip to content

Commit 9d9c6dc

Browse files
committed
corrected original md_content not updating on first run when using replace_figures_in_markdown function.
1 parent 1c3fa12 commit 9d9c6dc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

conversion2025/mathpix_to_llm_to_in2lambda_to_JSON.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
"metadata": {},
262262
"outputs": [],
263263
"source": [
264-
"def replace_figures_in_markdown(md_content, figures):\n",
264+
"def replace_figures_in_markdown(md_content, figures) -> str:\n",
265265
" #replace the image URLs in the markdown content with local paths\n",
266266
" # add pictureTag for Lambda Feedback to recognise it as a picture\n",
267267
" md_content = md_content.replace(\"![]\", \"![pictureTag]\")\n",
@@ -275,8 +275,10 @@
275275
" print(\"Modified markdown saved successfully.\")\n",
276276
" except Exception as e:\n",
277277
" print(f\"Error saving modified markdown: {e}\")\n",
278+
" \n",
279+
" return md_content\n",
278280
"\n",
279-
"replace_figures_in_markdown(md_content, figures)"
281+
"md_content = replace_figures_in_markdown(md_content, figures)"
280282
]
281283
},
282284
{
@@ -935,10 +937,10 @@
935937
" dict: A dictionary containing the keys \"name\" and \"exercise\".\n",
936938
" If parsing fails, returns None.\n",
937939
" \"\"\"\n",
938-
" # corrected_md_content = correct_mistakes_in_markdown(md_content)\n",
939-
" # print(\"Markdown content corrected for spelling, grammar, and structure.\")\n",
940+
" corrected_md_content = correct_mistakes_in_markdown(md_content)\n",
941+
" print(\"Markdown content corrected for spelling, grammar, and structure.\")\n",
940942
"\n",
941-
" questions_dict = extract_questions(md_content)\n",
943+
" questions_dict = extract_questions(corrected_md_content)\n",
942944
" print(\"successfully extracted the questions from the markdown. Now extracting the parts...\")\n",
943945
"\n",
944946
" extracted_dict = extract_parts_question(questions_dict)\n",

0 commit comments

Comments
 (0)