Skip to content

Instantly share code, notes, and snippets.

View sweet-language's full-sized avatar

michael louis sweet-language

View GitHub Profile
@sweet-language
sweet-language / gpu_server.py
Last active April 10, 2026 13:47
combined gaze+matting server
"""
Speaklab combined GPU server: gaze correction + background matting.
Single endpoint handles both pipelines, sharing download/normalize/encode steps.
Optimized: downscale for face detection, numpy compositing (no intermediate FFmpeg).
POST / — process video
video_url, supabase_url, supabase_key (required)
gaze: bool (default false), gaze_x, gaze_y
matting: bool (default false), bg_mode, bg_color
@sweet-language
sweet-language / gaze_server.py
Created April 9, 2026 13:55
gaze server for vast.ai
"""
Vast.ai GPU server for LivePortrait eye contact correction.
Takes a video where the person is looking at their screen (not camera),
and corrects their gaze to look directly at the camera.
Uses LivePortrait's keypoint manipulation: modifies eye keypoints
(indices 11, 15) to redirect gaze, then renders with full pipeline.
Pipeline:
@sweet-language
sweet-language / vastai_server.py
Created April 9, 2026 06:34
RVM matting server v2
"""
Vast.ai GPU model server for RVM video matting.
Simple HTTP server that receives matting jobs and returns results.
Vast.ai PyWorker proxies requests to this server.
Proxy-Matte Workflow:
1. Download video
2. FFmpeg downscale to 540p proxy (skip if source ≤540p)
3. RVM inference on proxy → grayscale alpha matte video
import json, urllib.request
u = "https://pjxynrqzydcxstnpsbtg.supabase.co"
v = u + "/storage/v1/object/public/video-matting/"
v += "temp/bc175e3e-dd17-42e2-81b1-dd92b200173f/input.webm"
k = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."
k += "eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBqeH"
k += "lucnF6eWRjeHN0bnBzYnRnIiwicm9sZSI6InNlcn"
k += "ZpY2Vfcm9sZSIsImlhdCI6MTczMTk4MTYyNiwiZXh"
k += "wIjoyMDQ3NTU3NjI2fQ.S1v0czmrqPqSKx7LYMB"
k += "cmRBXnEFmmiaKz2tXJOHPXtI"