Skip to content

Repository files navigation

PDF to PPTX

DocLayout-YOLO를 사용하여 PDF 파일을 레이아웃 요소가 분리된 PPTX로 변환하는 FastAPI 애플리케이션입니다.

설치

필수 요구사항

  • Python 3.13 이상
  • uv (권장 패키지 매니저)

uv 설치

# Windows (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

의존성 설치

optional-dependencies를 사용합니다.

  • 기본 (CPU): uv sync --extra cpu
  • CUDA: uv sync --extra cuda

GPU 지원 (선택)

  • Windows / Linux: CUDA 13.0용 PyTorch가 자동으로 설치됩니다 (pyproject.tomlpytorch-cu130 인덱스).
  • macOS: CPU 전용 PyTorch가 설치됩니다.

모델 다운로드

최초 실행 시 DocLayout-YOLO 모델이 HuggingFace Hub에서 자동으로 다운로드됩니다 (~약 100MB).

실행

# 개발 서버 (코드 변경 시 자동 재시작)
uv run task dev

# 프로덕션 서버
uv run task runserver

접속 URL

서버 실행 후 http://localhost:8000 기준:

URL 설명
/ 데모 페이지로 리다이렉트
/dist/index.html PDF → PPTX 변환 데모 페이지
/health 서버 상태 확인 (사용 중인 device 포함)
/docs Swagger UI API 문서
/redoc ReDoc API 문서

API 엔드포인트

메서드 URL 설명
POST /convert PDF 업로드, 변환 작업 생성 (job_id 반환)
GET /convert/{job_id}/events SSE로 변환 진행 상황 스트리밍
GET /convert/{job_id}/result 변환된 PPTX 파일 다운로드
POST /convert/sync 동기 변환 (업로드 후 바로 PPTX 반환)

외부 접속

--host 0.0.0.0으로 바인딩 시 같은 네트워크의 다른 기기에서 접속 가능합니다:

  • http://<서버IP>:8000
  • http://<서버IP>:8000/dist/index.html

CORS

CORS가 allow_origins=["*"]로 설정되어 있어 외부 도메인에서 API 호출이 가능합니다.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages