Frontend2026년 2월 16일1분 읽기

WebGPU 심화 — 브라우저 내 AI 추론 실행

YS
YoungSam
조회 1655

브라우저 AI 추론

WebGPU + ONNX Runtime으로 브라우저에서 AI 모델을 실행합니다. 서버 없이 프라이버시를 보장합니다.

ONNX Runtime Web

import * as ort from "onnxruntime-web";

// WebGPU 백엔드 사용
ort.env.wasm.numThreads = 4;
const session = await ort.InferenceSession.create(
  "./model.onnx",
  { executionProviders: ["webgpu"] }
);

const input = new ort.Tensor("float32", imageData, [1, 3, 224, 224]);
const results = await session.run({ input });
const predictions = results.output.data;

활용 사례

  • 실시간 이미지 분류
  • 텍스트 임베딩 생성
  • 얼굴/객체 감지
WebGPUAIBrowser

댓글 0

아직 댓글이 없습니다.