Quickstart
Frame-rate interpolation with lexigram-multimedia-interpolate — up and running in minutes.
Install
Section titled “Install”uv add lexigram-multimedia-interpolateThe package works out of the box as an HTTP client. Only add the extra when you want to run the bundled RIFE reference server itself (needs PyTorch):
uv add "lexigram-multimedia-interpolate[rife-server]"Minimal Working Example
Section titled “Minimal Working Example”import asyncio
from lexigram import Applicationfrom lexigram.contracts.multimedia import ( InterpolationProvider, InterpolationRequest, MediaAsset,)from lexigram.multimedia.interpolate import InterpolationModule
async def main() -> None: async with Application.boot(modules=[InterpolationModule.configure()]) as app: interpolate: InterpolationProvider = await app.container.resolve( InterpolationProvider )
frame_a = MediaAsset( mime_type="image/png", provider="demo", bytes_data=open("frame_a.png", "rb").read(), ) frame_b = MediaAsset( mime_type="image/png", provider="demo", bytes_data=open("frame_b.png", "rb").read(), )
result = await interpolate.interpolate( InterpolationRequest(frame_a=frame_a, frame_b=frame_b) )
if result.is_ok(): mid = result.unwrap() # synthesized midpoint frame with open("midframe.png", "wb") as f: f.write(mid.bytes_data)
if __name__ == "__main__": asyncio.run(main())Prerequisites: a RIFE server answering POST /interpolate (base64 frame_a_bytes
frame_b_bytes→ midpoint PNG) athttp://localhost:5500.
What Just Happened
Section titled “What Just Happened”InterpolationModule.configure()created aDynamicModulewrapping anInterpolationGenerationProviderand exportingInterpolationProviderandInterpolationTask.- During
Application.boot()the provider’sregister()ran:InterpolationConfigwas bound in the container as a singleton.RifeInterpolationProviderwas constructed and registered as theInterpolationProvider(backend ="rife", default).InterpolationTaskwas wired around the same backend forlexigram-taskssubmit()jobs.- If the container already had a
VideoProcessor, aVideoInterpolationServicewas composed and registered too.
- Your call
interpolate(InterpolationRequest(frame_a, frame_b))posted both frames (base64) and received the synthesized midpoint frame asResult[MediaAsset, MultimediaError].
Next Steps
Section titled “Next Steps”- Guide — concepts, frame-pair vs video interpolation
- How-Tos — task-oriented recipes
- Configuration — config keys and env-var overrides