import gradio as gr from caption_store import get_all_collections def render_ingest(): with gr.Column(visible=True, elem_classes="page-container") as page: gr.HTML("""

📥 Ingest Photos

Upload images to your archive and generate AI descriptions.

""") with gr.Row(equal_height=True): # Left: File Uploader with gr.Column(scale=3): upload = gr.File( label="Drag & Drop Images Here", file_count="multiple", file_types=[".jpg", ".jpeg", ".png", ".webp", ".tiff"], height=280, elem_classes="upload-zone" ) # Right: Destination & Collection Controls with gr.Column(scale=2, elem_classes="settings-card"): gr.Markdown("### ⚙️ Collection Destination") use_new_coll = gr.Checkbox( label="Create a brand new collection", value=False, elem_classes="custom-checkbox" ) # Safely parse collection values on first load choices = get_all_collections() if not choices: choices = ["General"] default_val = "General" if "General" in choices else choices[0] coll_dropdown = gr.Dropdown( choices=choices, label="Target Collection", value=default_val, interactive=True, visible=True ) new_coll_name = gr.Textbox( label="New Collection Name", placeholder="e.g. Summer Vacation 2024", visible=False ) ingest_btn = gr.Button( "🚀 Start Processing", variant="primary", size="lg" ) # Bottom: Terminal-style status log with gr.Column(elem_classes="console-wrapper"): gr.Markdown("### 🖥️ Ingestion Logs") ingest_status = gr.Textbox( value="System ready. Awaiting file upload...", show_label=False, interactive=False, lines=6, elem_classes="status-console" ) return page, upload, coll_dropdown, use_new_coll, new_coll_name, ingest_btn, ingest_status