File size: 1,423 Bytes
8074673
b1b2cec
8074673
 
 
 
 
 
 
 
 
b1b2cec
8074673
 
b1b2cec
4a9a269
b1b2cec
067d7b2
b1b2cec
 
 
 
 
d77d8e5
b1b2cec
 
 
 
 
 
 
 
 
067d7b2
4a9a269
 
 
 
b1b2cec
 
4a9a269
 
 
 
 
 
b1b2cec
4a9a269
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
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).