import os from pathlib import Path import gradio as gr ROOT = Path("/work") def list_repo(): # Show a small tree of notebooks/scripts to confirm they are in the image exts = {".ipynb", ".py"} files = sorted([p.relative_to(ROOT) for p in ROOT.rglob("*") if p.suffix in exts]) if not files: return "No .ipynb/.py files found under /work (did you COPY the repo into the image?)" return "\n".join(str(p) for p in files[:300]) with gr.Blocks(title="Split-Skip-and-Play") as demo: gr.Markdown("# Split-Skip-and-Play\nA lightweight UI (Gradio) running on Hugging Face Spaces.") out = gr.Textbox(label="Repo notebooks/scripts (first 300)", lines=20) gr.Button("Refresh file list").click(fn=list_repo, outputs=out) demo.launch( server_name="0.0.0.0", server_port=int(os.getenv("PORT", "7860")), )