"""Hugging Face Spaces entry point for the public Memory Studio demo. Locally, run ``memory_studio.py`` instead: it binds to ``127.0.0.1``, creates no sharing link, and keeps inference on your machine. This file exists only so a Gradio Space can start the same UI on the Space's public port. Deploying this way is a **public demo**: prompts and image cues are sent to the Space and processed there, so the on-device privacy promise does not apply. """ from __future__ import annotations import os # Spaces sets SPACE_ID, but set the flag explicitly so the public wording also # applies when this entry point is tested in a container. os.environ.setdefault("MEMORY_PUBLIC_DEMO", "1") # The Space has a free GPU, so it uses a larger image model than the local # default. Both are public downloads and need no token. os.environ.setdefault("MEMORY_IMAGE_MODEL", "segmind/SSD-1B") # The larger text model follows the story-line format far better than the # 360M local default, and the Space's free GPU runs it in seconds. os.environ.setdefault("MEMORY_MODEL", "HuggingFaceTB/SmolLM2-1.7B-Instruct") # When a visitor's free GPU quota runs out, drafts fall back to the small model # on CPU, which needs no GPU quota. os.environ.setdefault("MEMORY_FALLBACK_MODEL", "HuggingFaceTB/SmolLM2-360M-Instruct") os.environ.setdefault("MEMORY_IMAGE_DEFAULT_SIZE", "768") os.environ.setdefault("MEMORY_IMAGE_DEFAULT_STEPS", "8") from memory_studio import ( # noqa: E402 (env first) APP_CSS, APP_HEAD, APP_THEME, QUEUE_CONCURRENCY, demo, ) if __name__ == "__main__": demo.queue(default_concurrency_limit=QUEUE_CONCURRENCY).launch( server_name=os.getenv("MEMORY_HOST", "0.0.0.0"), server_port=int(os.getenv("PORT", "7860")), share=False, show_error=False, theme=APP_THEME, css=APP_CSS, head=APP_HEAD, )