Spaces:
Sleeping
Sleeping
Update export/ppt.py
Browse files- export/ppt.py +2 -4
export/ppt.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
# export/ppt.py
|
| 2 |
from pptx import Presentation
|
| 3 |
from typing import Dict, List
|
|
|
|
| 4 |
|
| 5 |
def _add_bullets(prs: Presentation, title: str, body: str):
|
| 6 |
layout = prs.slide_layouts[1] # Title and Content
|
|
@@ -24,7 +25,7 @@ def build_deck(sections: Dict[str, str], links: List[str]) -> Presentation:
|
|
| 24 |
title_slide_layout = prs.slide_layouts[0]
|
| 25 |
s0 = prs.slides.add_slide(title_slide_layout)
|
| 26 |
s0.shapes.title.text = "IR/PR サマリー"
|
| 27 |
-
s0.placeholders[1].text = "自動生成(RAG)"
|
| 28 |
|
| 29 |
_add_bullets(prs, "業績ハイライト", sections.get("highlights",""))
|
| 30 |
_add_bullets(prs, "見通し", sections.get("outlook",""))
|
|
@@ -33,13 +34,10 @@ def build_deck(sections: Dict[str, str], links: List[str]) -> Presentation:
|
|
| 33 |
_add_bullets(prs, "株主還元", sections.get("shareholder",""))
|
| 34 |
_add_bullets(prs, "ESG", sections.get("esg",""))
|
| 35 |
_add_bullets(prs, "リスク", sections.get("risks",""))
|
| 36 |
-
|
| 37 |
-
# 参考リンク
|
| 38 |
_add_bullets(prs, "参考リンク", "\n".join(links or []))
|
| 39 |
return prs
|
| 40 |
|
| 41 |
def save_pptx(prs: Presentation, path: str) -> str:
|
| 42 |
-
import os
|
| 43 |
os.makedirs(os.path.dirname(path), exist_ok=True)
|
| 44 |
prs.save(path)
|
| 45 |
return path
|
|
|
|
| 1 |
# export/ppt.py
|
| 2 |
from pptx import Presentation
|
| 3 |
from typing import Dict, List
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
def _add_bullets(prs: Presentation, title: str, body: str):
|
| 7 |
layout = prs.slide_layouts[1] # Title and Content
|
|
|
|
| 25 |
title_slide_layout = prs.slide_layouts[0]
|
| 26 |
s0 = prs.slides.add_slide(title_slide_layout)
|
| 27 |
s0.shapes.title.text = "IR/PR サマリー"
|
| 28 |
+
s0.placeholders[1].text = "自動生成(RAG + OpenAI)"
|
| 29 |
|
| 30 |
_add_bullets(prs, "業績ハイライト", sections.get("highlights",""))
|
| 31 |
_add_bullets(prs, "見通し", sections.get("outlook",""))
|
|
|
|
| 34 |
_add_bullets(prs, "株主還元", sections.get("shareholder",""))
|
| 35 |
_add_bullets(prs, "ESG", sections.get("esg",""))
|
| 36 |
_add_bullets(prs, "リスク", sections.get("risks",""))
|
|
|
|
|
|
|
| 37 |
_add_bullets(prs, "参考リンク", "\n".join(links or []))
|
| 38 |
return prs
|
| 39 |
|
| 40 |
def save_pptx(prs: Presentation, path: str) -> str:
|
|
|
|
| 41 |
os.makedirs(os.path.dirname(path), exist_ok=True)
|
| 42 |
prs.save(path)
|
| 43 |
return path
|