File size: 1,191 Bytes
ed795b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
tags:
- endpoints-template
- video-generation
- diffusers
inference: false
---

# hunyuanvideo-endpoint

HunyuanVideo with custom handler for Inference Endpoints

## Usage

This repository contains a custom inference handler for HuggingFace Inference Endpoints.

### Deploy

1. Go to [HuggingFace Inference Endpoints](https://ui.endpoints.huggingface.co/)
2. Click "New Endpoint"
3. Select this repository: `ainativestudio/hunyuanvideo-endpoint`
4. Choose GPU instance (NVIDIA L4 or A100)
5. Deploy

### API Usage

```python
import requests
import base64

response = requests.post(
    "YOUR_ENDPOINT_URL",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    json={
        "inputs": "A beautiful sunset over the ocean",
        "num_inference_steps": 50,
        "guidance_scale": 6.0
    }
)

video_base64 = response.json()["video"]
video_bytes = base64.b64decode(video_base64)

with open("output.mp4", "wb") as f:
    f.write(video_bytes)
```

## Custom Handler

The `handler.py` file implements the `EndpointHandler` class required for custom inference.
See the [HuggingFace documentation](https://huggingface.co/docs/inference-endpoints/guides/custom_handler) for more details.