Spaces:
Running
Running
Update gen_ppt.py
Browse files- gen_ppt.py +17 -17
gen_ppt.py
CHANGED
|
@@ -151,29 +151,29 @@ def main():
|
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
-
# ============================= PPT部分 ================================
|
| 155 |
|
| 156 |
-
# === 按照算法选出结点,以便后续生成outline ===
|
| 157 |
-
selected_node_path=os.path.join(auto_path, "selected_node.json")
|
| 158 |
-
generate_selected_nodes(dag_json_path=dag_path, max_len=15,output_path=selected_node_path)
|
| 159 |
|
| 160 |
-
# === 初始化ouline ===
|
| 161 |
-
outline_path= os.path.join(auto_path, "outline.json")
|
| 162 |
-
outline = outline_initialize(dag_json_path=dag_path,outline_initialize_prompt=outline_initialize_prompt,model=model_name, config=config)
|
| 163 |
|
| 164 |
-
# === 生成完整ouline ===
|
| 165 |
-
outline_data=generate_complete_outline(selected_node_path,outline_path,generate_complete_outline_prompt,model=model_name, config=config)
|
| 166 |
|
| 167 |
-
# === 配模板 ===
|
| 168 |
-
arrange_template(outline_path,arrange_template_prompt,model=model_name, config=config)
|
| 169 |
|
| 170 |
-
# === 生成最终的PPT ===
|
| 171 |
-
ppt_template_path="./ppt_template"
|
| 172 |
-
generate_ppt_prompt = {"role":"system","content":"You are given (1) a slide node (JSON) and (2) an HTML slide template. Your task: revise the HTML template to produce the final slide HTML using the node content. Node fields: text (slide textual content), figure (list of images to display, each has name, caption, resolution), formula (list of formula images to display, each has name, caption, resolution), template (template filename). IMPORTANT RULES: 1) Only modify places in the HTML that are marked by comments like . 2) For 'Subjects' sections: replace the placeholder title with ONE concise summary sentence for this slide. 3) For 'Image' sections (<img ...>): replace src with the relative path extracted from node.figure/formula[i].name; the node image name may be markdown like '', use only 'images/abc.jpg'. 4) For 'Text' sections: replace the placeholder text with the node.text content, formatted cleanly in HTML; keep it readable and you may use <p>, <ul><li>, <br/> appropriately. 5) If the template expects more images/text blocks than provided by the node, leave the missing positions unchanged and do not invent content. 6) If the node provides more images than the template has slots, fill slots in order and ignore the rest. 7) Preserve all other HTML, CSS, and structure exactly. OUTPUT FORMAT: Return ONLY the revised HTML as plain text. Do NOT wrap it in markdown fences. Do NOT add explanations."}
|
| 173 |
-
generate_ppt(outline_path,ppt_template_path,generate_ppt_prompt,model=model_name, config=config)
|
| 174 |
|
| 175 |
-
# === Refiner ===
|
| 176 |
-
refinement_ppt(input_index=auto_path, prompts=[commenter_prompt, reviser_prompt], model=model_name, max_iterations=3, config=config)
|
| 177 |
|
| 178 |
# # ============================= Poster部分 ================================
|
| 179 |
|
|
|
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
+
# # ============================= PPT部分 ================================
|
| 155 |
|
| 156 |
+
# # === 按照算法选出结点,以便后续生成outline ===
|
| 157 |
+
# selected_node_path=os.path.join(auto_path, "selected_node.json")
|
| 158 |
+
# generate_selected_nodes(dag_json_path=dag_path, max_len=15,output_path=selected_node_path)
|
| 159 |
|
| 160 |
+
# # === 初始化ouline ===
|
| 161 |
+
# outline_path= os.path.join(auto_path, "outline.json")
|
| 162 |
+
# outline = outline_initialize(dag_json_path=dag_path,outline_initialize_prompt=outline_initialize_prompt,model=model_name, config=config)
|
| 163 |
|
| 164 |
+
# # === 生成完整ouline ===
|
| 165 |
+
# outline_data=generate_complete_outline(selected_node_path,outline_path,generate_complete_outline_prompt,model=model_name, config=config)
|
| 166 |
|
| 167 |
+
# # === 配模板 ===
|
| 168 |
+
# arrange_template(outline_path,arrange_template_prompt,model=model_name, config=config)
|
| 169 |
|
| 170 |
+
# # === 生成最终的PPT ===
|
| 171 |
+
# ppt_template_path="./ppt_template"
|
| 172 |
+
# generate_ppt_prompt = {"role":"system","content":"You are given (1) a slide node (JSON) and (2) an HTML slide template. Your task: revise the HTML template to produce the final slide HTML using the node content. Node fields: text (slide textual content), figure (list of images to display, each has name, caption, resolution), formula (list of formula images to display, each has name, caption, resolution), template (template filename). IMPORTANT RULES: 1) Only modify places in the HTML that are marked by comments like . 2) For 'Subjects' sections: replace the placeholder title with ONE concise summary sentence for this slide. 3) For 'Image' sections (<img ...>): replace src with the relative path extracted from node.figure/formula[i].name; the node image name may be markdown like '', use only 'images/abc.jpg'. 4) For 'Text' sections: replace the placeholder text with the node.text content, formatted cleanly in HTML; keep it readable and you may use <p>, <ul><li>, <br/> appropriately. 5) If the template expects more images/text blocks than provided by the node, leave the missing positions unchanged and do not invent content. 6) If the node provides more images than the template has slots, fill slots in order and ignore the rest. 7) Preserve all other HTML, CSS, and structure exactly. OUTPUT FORMAT: Return ONLY the revised HTML as plain text. Do NOT wrap it in markdown fences. Do NOT add explanations."}
|
| 173 |
+
# generate_ppt(outline_path,ppt_template_path,generate_ppt_prompt,model=model_name, config=config)
|
| 174 |
|
| 175 |
+
# # === Refiner ===
|
| 176 |
+
# refinement_ppt(input_index=auto_path, prompts=[commenter_prompt, reviser_prompt], model=model_name, max_iterations=3, config=config)
|
| 177 |
|
| 178 |
# # ============================= Poster部分 ================================
|
| 179 |
|