Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.3.0
metadata
title: DeepSeek OCR
emoji: π
colorFrom: red
colorTo: red
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: true
short_description: DeepSeek-OCR demo on PDF and img
license: mit
API Usage
Using Gradio Client
from gradio_client import Client
client = Client("BinKhoaLe1812/DeepseekOCR")
# Process a PDF or image file
result = client.predict(
file_path="path/to/document.pdf", # or image file
mode="Gundam", # Options: Gundam, Tiny, Small, Base, Large
task="π Markdown", # Options: π Markdown, π Free OCR, π Locate, π Describe, βοΈ Custom
custom_prompt="", # Required for Custom or Locate tasks
page_num=1, # Page number (all pages are processed for PDFs)
api_name="/run"
)
# Result contains: [text_out, markdown_out, raw_out, img_out, gallery]
text, markdown, raw, image, crops = result
print(text) # Extracted text
print(markdown) # Markdown formatted output
Using HTTP API
import requests
# Upload file and process
with open("document.pdf", "rb") as f:
files = {"files": f}
data = {
"mode": "Gundam",
"task": "π Markdown",
"custom_prompt": "",
"page_num": 1
}
response = requests.post(
"https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/api/predict",
files=files,
data=data
)
result = response.json()