| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
將靜態圖片轉換為 2.5D 視差動畫的 REST API 服務,基於 DepthFlow 開源專案。
使用 Google Colab 免費 GPU 資源快速部署:
詳細說明請參考 Colab 部署指南
使用 Docker Compose 一鍵部署:
cd docker
docker-compose up -d服務將在以下端口啟動:
git clone <your-repo-url>
cd depthflow-apipython3 -m venv venv
source venv/bin/activate # Linux/macOS
# 或 venv\Scripts\activate # Windowspip install -r requirements.txtcp .env.example .env
# 編輯 .env 檔案,設定必要的參數python -m app.maincurl -X POST "http://localhost:8080/api/v1/process" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/image.jpg" \
-F 'request={
"parameters": {
"depth_strength": 1.5,
"animation_duration": 3.0,
"fps": 30,
"output_format": "mp4"
}
}'回應範例:
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"created_at": "2024-01-16T10:30:00Z",
"updated_at": "2024-01-16T10:30:00Z"
}curl -X GET "http://localhost:8080/api/v1/task/{task_id}"回應範例:
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"progress": 100,
"message": "處理完成",
"result_url": "/api/v1/result/550e8400-e29b-41d4-a716-446655440000"
}curl -X GET "http://localhost:8080/api/v1/result/{task_id}" \
--output result.mp4| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| depth_strength | float | 1.0 | 深度強度 (0.1-5.0) |
| animation_duration | float | 3.0 | 動畫時長(秒)(1.0-10.0) |
| fps | int | 30 | 影格率 (15-60) |
| output_format | string | mp4 | 輸出格式 (mp4/webm/gif) |
| resolution | int | null | 最大解析度 (480-2048) |
| loop | bool | true | 是否循環播放 |
| depth_model | string | default | 深度估計模型 |
| camera_movement | string | orbit | 相機運動模式 (orbit/zoom/dolly/static) |
depthflow-api/ ├── app/ │ ├── api/ # API 路由和端點 │ ├── models/ # 資料模型 │ ├── services/ # 商業邏輯服務 │ ├── tasks/ # 非同步任務 │ └── utils/ # 工具函數 ├── storage/ # 檔案儲存 ├── docker/ # Docker 配置 ├── colab-deployment/ # Google Colab 部署方案 ├── tests/ # 測試檔案 └── requirements.txt # Python 依賴
如果您的伺服器有 NVIDIA GPU,可以在 docker-compose.yml 中啟用 GPU 支援:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]如果出現 DepthFlow 相關錯誤,請確保已正確安裝:
pip install depthflow檢查 CUDA 和 GPU 驅動是否正確安裝:
nvidia-smi本專案基於 MIT 授權條款開源。
歡迎提交 Pull Request 或開啟 Issue!
| Back | FazBrowse Home | New Git URL |