Spaces:
Running
Running
Update gen_dag.py
Browse files- gen_dag.py +23 -23
gen_dag.py
CHANGED
|
@@ -121,38 +121,38 @@ def main():
|
|
| 121 |
output_html = os.path.join(auto_path, "poster.html")
|
| 122 |
graph_json_path = os.path.join(auto_path, "graph.json")
|
| 123 |
|
| 124 |
-
#
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
|
| 129 |
-
#
|
| 130 |
-
|
| 131 |
|
| 132 |
-
#
|
| 133 |
-
|
| 134 |
-
|
| 135 |
|
| 136 |
|
| 137 |
-
#
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
|
| 142 |
-
#
|
| 143 |
-
|
| 144 |
-
|
| 145 |
|
| 146 |
|
| 147 |
-
#
|
| 148 |
-
|
| 149 |
-
|
| 150 |
|
| 151 |
-
#
|
| 152 |
-
|
| 153 |
|
| 154 |
-
#
|
| 155 |
-
|
| 156 |
|
| 157 |
|
| 158 |
|
|
|
|
| 121 |
output_html = os.path.join(auto_path, "poster.html")
|
| 122 |
graph_json_path = os.path.join(auto_path, "graph.json")
|
| 123 |
|
| 124 |
+
# === 清理 markdown === 去除无意义的段落,如relative work,reference,appendix等等
|
| 125 |
+
print(config)
|
| 126 |
+
print("🧹 Cleaning markdown before splitting...")
|
| 127 |
+
cleaned_md_path = clean_paper(md_path, clean_prompt, model="gemini-3-pro-preview", config=config)
|
| 128 |
|
| 129 |
+
# === 利用gpt将论文分段 ===
|
| 130 |
+
paths = split_paper(cleaned_md_path, section_split_prompt, model="gemini-3-pro-preview" ,config=config)
|
| 131 |
|
| 132 |
+
# === 利用gpt初始化dag ===
|
| 133 |
+
dag = initialize_dag(markdown_path=cleaned_md_path,initialize_dag_prompt=initialize_dag_prompt,model="gemini-3-pro-preview", config=config)
|
| 134 |
+
dag_path = os.path.join(auto_path, "dag.json")
|
| 135 |
|
| 136 |
|
| 137 |
+
# === 生成visual_dag ===
|
| 138 |
+
visual_dag_path=os.path.join(auto_path, "visual_dag.json")
|
| 139 |
+
extract_and_generate_visual_dag(markdown_path=cleaned_md_path,prompt_for_gpt=visual_dag_prompt,output_json_path=visual_dag_path,model="gemini-3-pro-preview", config=config)
|
| 140 |
+
add_resolution_to_visual_dag(auto_path, visual_dag_path)
|
| 141 |
|
| 142 |
+
# === 生成section_dag ===
|
| 143 |
+
section_split_output_path=os.path.join(subdir_path, "section_split_output")
|
| 144 |
+
build_section_dags(folder_path=section_split_output_path,base_prompt=section_dag_generation_prompt,model="gemini-3-pro-preview", config=config)
|
| 145 |
|
| 146 |
|
| 147 |
+
# === 向dag.json添加section_dag ===
|
| 148 |
+
section_dag_path=os.path.join(subdir_path, "section_dag")
|
| 149 |
+
merged_path = add_section_dag(section_dag_folder=section_dag_path,main_dag_path=dag_path,output_path=None)
|
| 150 |
|
| 151 |
+
# === 向dag.json添加visual_dag ===
|
| 152 |
+
add_visual_dag(dag_path=dag_path,visual_dag_path=visual_dag_path)
|
| 153 |
|
| 154 |
+
# === 完善dag中每一个结点的visual_node ===
|
| 155 |
+
refine_visual_node(dag_path)
|
| 156 |
|
| 157 |
|
| 158 |
|