74 lines
1.5 KiB
Python
74 lines
1.5 KiB
Python
import marimo
|
|
|
|
__generated_with = "0.19.2"
|
|
app = marimo.App(width="medium")
|
|
|
|
with app.setup:
|
|
import marimo as mo
|
|
from pathlib import Path
|
|
import utils
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
mo.md(r"""
|
|
# Tag existing images with Alt-Text
|
|
|
|
Based on image content
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
TAG_SOURCE = Path('data/test_tag_source.pptx')
|
|
TAG_TARGET = Path('data/test_tag_target.pptx')
|
|
TAG_IMAGE_DIR = Path('figures/OneDrive_2026-01-28/')
|
|
return TAG_IMAGE_DIR, TAG_SOURCE, TAG_TARGET
|
|
|
|
|
|
@app.cell
|
|
def _(TAG_IMAGE_DIR, TAG_SOURCE, TAG_TARGET):
|
|
utils.update_ppt_alt_text(ppt_path=TAG_SOURCE, image_source_dir=TAG_IMAGE_DIR, output_path=TAG_TARGET)
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
mo.md(r"""
|
|
# Replace Images using Alt-Text
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
REPLACE_SOURCE = Path('data/test_replace_source.pptx')
|
|
REPLACE_TARGET = Path('data/test_replace_target.pptx')
|
|
return REPLACE_SOURCE, REPLACE_TARGET
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
IMAGE_FILE = Path('figures/OneDrive_2026-01-28/Cons-Early_Professional/cold_distant_approachable_familiar_warm.png')
|
|
return (IMAGE_FILE,)
|
|
|
|
|
|
@app.cell
|
|
def _(IMAGE_FILE, REPLACE_SOURCE, REPLACE_TARGET):
|
|
utils.pptx_replace_named_image(
|
|
presentation_path=REPLACE_SOURCE,
|
|
target_tag=utils.image_alt_text_generator(IMAGE_FILE),
|
|
new_image_path=IMAGE_FILE,
|
|
save_path=REPLACE_TARGET)
|
|
return
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|