Mural Registry
Public-art mural registry API: wall photo uploads with thumbnails, grayscale copies and color tags
One app.py with 1 table, 5 computed columns, 5 HTTP routes. Needs pixeltable[serve]>=0.7.14. Updated 2026-10-05.
app.py
"""Mural Registry API built with Pixeltable.pxt schema update app.py muralspxt service run app.py murals"""import pixeltable as pxtimport pixeltable.functions as pxtffrom pixeltable.serving import FastAPIRouterfrom udfs import aspect_band, dominant_channel, tone_tag# ---- tables ----TableModel = pxt.model_base()class Murals(TableModel, name='murals', has_default_idxs=False):id = pxt.Column(value=pxtf.uuid.uuid7(), primary_key=True)title: pxt.Stringartist: pxt.Stringneighborhood: pxt.Stringwall_photo: pxt.Imagethumb = wall_photo.resize((96, 64)) # generated mediagray = wall_photo.convert('L') # generated mediaaspect = aspect_band(wall_photo)channel = dominant_channel(wall_photo)tone = tone_tag(aspect, channel) # chained on two computed columns__indexes__ = [pxt.BtreeIndex(neighborhood)]# ---- queries ----@pxt.querydef in_neighborhood(neighborhood: str):"""Murals in one neighborhood (neighborhood index)."""return Murals.where(Murals.neighborhood == neighborhood).select(Murals.id, Murals.title, Murals.artist, Murals.aspect, Murals.tone).order_by(Murals.title)@pxt.querydef mural_thumb(title: str):"""The thumbnail for a mural title (served as an image file)."""return Murals.where(Murals.title == title).order_by(Murals.id, asc=False).limit(1).select(Murals.thumb)# ---- routes ----mural_api = FastAPIRouter(name='mural_api')mural_api.add_insert_route(Murals, path='/murals',inputs=[Murals.title, Murals.artist, Murals.neighborhood],uploadfile_inputs=[Murals.wall_photo],outputs=[Murals.id, Murals.aspect, Murals.channel, Murals.tone],)mural_api.add_compute_route(Murals, path='/analyze', inputs=[], uploadfile_inputs=[Murals.wall_photo],outputs=[Murals.aspect, Murals.channel, Murals.tone])mural_api.add_delete_route(Murals, path='/murals/delete')mural_api.add_query_route(path='/murals/by-neighborhood', query=in_neighborhood, method='get')mural_api.add_query_route(path='/murals/thumb', query=mural_thumb, method='get', one_row=True,return_fileresponse=True)
What app.py declares
Each row links to its line.
- runs on insert
- stored
- index
- route
serves mural_api
- POST/muralsinsert, muralstakes title, artist, neighborhood; returns id, aspect, channel, toneL49
- POST/analyzecompute, muralsreturns aspect, channel, toneL55
- POST/murals/deletedelete, muralsL57
- GET/murals/by-neighborhoodquery, in_neighborhoodtakes neighborhoodL58
- GET/murals/thumbquery, mural_thumbtakes titleL59
Run it
Needs uv. The routes then answer on port 8000.
terminal
git clone https://github.com/pierrebrunelle/pixeltable-mural-registrycd pixeltable-mural-registryuv syncuv run pxt schema update app.py muralsuv run python seed.py muralsuv run pxt service run app.py murals --port 8000
Related apps
- Climbing Route ToposClimbing-route topo registry API: photo uploads with thumbnails, grayscale copies, grade bands and index-backed crag lookupsShares: B-tree indexes, Images, video and audio, UDFs, File uploads
- Travel ScrapbookTravel photo scrapbook API: image uploads, thumbnails and place tags as computed columnsShares: Images, video and audio, UDFs, File uploads
- Research Agent MemoryDurable, searchable long-term memory for an AI research assistant: per-user semantic recall, retrieval_udf lookups, tool calling and memory consolidation with custom aggregatesShares: B-tree indexes, Images, video and audio, UDFs