ocr / README.md
ZienabM's picture
Update README.md
1c89141 verified
metadata
title: DeepSeek OCR 2 API
emoji: 🔍
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: apache-2.0
app_port: 7860

DeepSeek-OCR-2 API

REST API لاستخراج النص من الصور باستخدام نموذج DeepSeek-OCR-2.

Endpoints

Method Path Description
GET / معلومات الـ API
GET /health فحص حالة النموذج
POST /ocr OCR عبر رفع ملف
POST /ocr/base64 OCR عبر base64 JSON

POST /ocr — Form Data

Field Type Required Description
image file صورة JPG/PNG/WEBP
x int بداية المحور الأفقي للـ crop (بكسل)
y int بداية المحور الرأسي للـ crop (بكسل)
w int عرض منطقة الـ crop (بكسل)
h int ارتفاع منطقة الـ crop (بكسل)
mode string free (افتراضي) أو markdown

مثال — cURL

# OCR كاملة للصورة
curl -X POST "https://YOUR-SPACE.hf.space/ocr" \
  -F "image=@pedigree.jpg" \
  -F "mode=free"

# OCR على منطقة محددة (bounding box)
curl -X POST "https://YOUR-SPACE.hf.space/ocr" \
  -F "image=@pedigree.jpg" \
  -F "x=100" -F "y=50" -F "w=300" -F "h=150" \
  -F "mode=free"

Response

{
  "text": "النص المستخرج من الصورة",
  "mode": "free",
  "cropped": true,
  "bbox": { "x": 100, "y": 50, "w": 300, "h": 150 }
}

POST /ocr/base64 — JSON Body

{
  "image_b64": "<base64 string>",
  "x": 100,
  "y": 50,
  "w": 300,
  "h": 150,
  "mode": "free"
}