Spaces:
Running
Running
| title: Document Processing | |
| emoji: 🦀 | |
| colorFrom: red | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 6.16.0 | |
| python_version: '3.13' | |
| app_file: app.py | |
| pinned: false | |
| license: apache-2.0 | |
| short_description: Smart Doc + patent translation via connect gateway | |
| # Document Processing | |
| Gradio demo with two tabs sharing one Bearer API key from the environment. | |
| ## Tabs | |
| | Tab | Gateway | Notes | | |
| |-----|---------|--------| | |
| | **Smart Doc** | `https://connect.zhihuiya.com/rd-llm/v1/documents/doc_parsing` | Multipart upload · `output_format=both` · **10 MB** max | | |
| | **Translation** | `https://connect.zhihuiya.com/hiro_translation` | `stream`: SSE via `POST /translate`; `fast`: async submit + poll (`POST /translate/async` → `GET /translate/async/{taskId}`) | | |
| ## Auth | |
| Set under Space **Settings → Variables / Secrets** (or local env): | |
| 1. `HIRO_API_KEY` (preferred) | |
| 2. else `RD_LLM_API_KEY` | |
| No API key field in the UI. | |
| ## Files | |
| | File | Purpose | | |
| |------|---------| | |
| | `app.py` | Gradio UI (tabs + streaming translation + document parse) | | |
| | `api_client.py` | HTTP clients for translation + Smart Doc | | |
| | `requirements.txt` | Python dependencies (`requests`; Gradio is pre-installed on Spaces) | | |
| ## Local run | |
| ```bash | |
| pip install -r requirements.txt | |
| export HIRO_API_KEY="sk-..." # or RD_LLM_API_KEY | |
| python app.py | |
| ``` | |
| Check out the [Spaces config reference](https://huggingface.co/docs/hub/spaces-config-reference). | |