Spaces:
Sleeping
Sleeping
| from llm.llm import LLM | |
| from utils.utils import read_json_file, write_json_file, write_text_file, json_to_markdown, read_text_file, parse_llm_output_to_json | |
| from agent.create_charts import Chart | |
| # from utils.convert_format import markdown_to_latex | |
| import os | |
| from prompt.template import PROBLEM_EXTRACT_PROMPT | |
| if __name__ == "__main__": | |
| import glob | |
| files = glob.glob('/Users/ann/Downloads/methmatical_paper_extraction/parse/2025_*/content/*.md') | |
| llm = LLM('chatgpt-4o-latest') | |
| data = {} | |
| for file in files: | |
| year, _, _, problem_type = file.split('/')[-1].split('.')[0].split('_') | |
| problem_name = f'{year}_{problem_type}' | |
| problem_str = read_text_file(file) | |
| problem = llm.generate(PROBLEM_EXTRACT_PROMPT.format(question=problem_str), problem_str) | |
| problem = parse_llm_output_to_json(problem) | |
| # data[problem_name] = problem | |
| print(problem) | |
| write_json_file(f'/Users/ann/Documents/projects/math_modeling/data/actor_data/input/problem/{problem_name}.json', problem) | |