ek-developers/ocr-frontend
๐ผ๏ธ DeepSeek OCR โ Frontend
A clean, professional Gradio frontend for the DeepSeek OCR API. Upload any image, write a custom prompt, and extract text in seconds โ no setup required.
This Space is a frontend only. All OCR processing is handled by the backend API Space powered by DeepSeek-OCR via Ollama.
๐ Related Spaces
โจ Features
- Image upload โ drag and drop, click to browse, or paste from clipboard
- Custom prompts โ guide the model with natural language instructions
- Auto-run on upload โ OCR triggers automatically when an image is dropped in
- Copy to clipboard โ one-click copy of extracted text with confirmation feedback
- Example prompts โ pre-built prompts for common use cases
- Live API status โ shows backend connection and endpoint URL
- Responsive layout โ two-column design with input on the left, output on the right
๐ฅ๏ธ Interface Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DeepSeek OCR โ
โ Powered by DeepSeek ยท Ollama โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 01 ยท INPUT โ 02 ยท EXTRACTED TEXT โ
โ โ โ
โ [ Image Upload ] โ โ API CONNECTED โ
โ โ โ
โ [ Prompt Input ] โ [ Result Textbox ] โ
โ โ โ
โ [โถ RUN] [โ CLEAR] โ [ โ COPY TEXT ] โ
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Example Prompts โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐ Usage
Step 1 โ Upload an image
Drag and drop an image onto the upload panel, click to browse your files, or paste directly from clipboard. Supported formats: JPG, PNG, WEBP, and other common image types.
Step 2 โ Set your prompt
The default prompt is Free OCR. which extracts all visible text. You can customize it to get more targeted results:
Step 3 โ Run OCR
Click โถ RUN OCR or simply upload an image โ OCR runs automatically on upload.
Step 4 โ Copy the result
Click โ COPY TEXT to copy the extracted text to your clipboard. A green confirmation message appears for 2 seconds.
โ๏ธ Configuration
Changing the backend API URL
By default the frontend points to:
https://ek-developers-my-ocr-api.hf.space/ocrTo point it at a different backend, set the OCR_API_URL environment variable in your Space settings:
- Go to your Space โ Settings โ Variables and secrets
- Add a new variable:
- Name:
OCR_API_URL - Value:
https://your-backend-space.hf.space/ocr
๐ Project Structure
โโโ app.py # Gradio UI and API call logic
โโโ requirements.txt # Python dependencies
โโโ README.md # Documentationapp.py โ key sections
๐ ๏ธ Local Development
Prerequisites
- Python 3.10+
- The backend API running (locally or on HF)
Setup
# Clone the Space
git clone https://huggingface.co/spaces/YOUR_USERNAME/ocr-frontend
cd ocr-frontend
# Install dependencies
pip install -r requirements.txt
# Optional: point at a local backend
export OCR_API_URL=http://localhost:7860/ocr
# Run
python app.pyThe app will be available at http://localhost:7860.
๐ฆ Dependencies
gradio>=6.6.0
requestsโ ๏ธ Notes
Cold starts โ the backend Space sleeps after ~15 minutes of inactivity on the free tier. The first request after inactivity may take 1โ2 minutes while the model reloads. The frontend will show a timeout message โ simply wait 30 seconds and try again.
Image quality โ OCR accuracy depends on image clarity. For best results:
- Use high-resolution images (300 DPI or above for documents)
- Ensure text is not skewed or heavily shadowed
- Avoid images with very low contrast between text and background
Clipboard permissions โ the copy button uses the browser's native clipboard API. If it does not work, ensure your browser has clipboard permissions enabled for the page.
๐ License
MIT License โ free to use, modify, and deploy.
