Instructions to use ainativestudio/hunyuanvideo-endpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ainativestudio/hunyuanvideo-endpoint with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ainativestudio/hunyuanvideo-endpoint", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- endpoints-template
|
| 4 |
+
- video-generation
|
| 5 |
+
- diffusers
|
| 6 |
+
inference: false
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# hunyuanvideo-endpoint
|
| 10 |
+
|
| 11 |
+
HunyuanVideo with custom handler for Inference Endpoints
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
This repository contains a custom inference handler for HuggingFace Inference Endpoints.
|
| 16 |
+
|
| 17 |
+
### Deploy
|
| 18 |
+
|
| 19 |
+
1. Go to [HuggingFace Inference Endpoints](https://ui.endpoints.huggingface.co/)
|
| 20 |
+
2. Click "New Endpoint"
|
| 21 |
+
3. Select this repository: `ainativestudio/hunyuanvideo-endpoint`
|
| 22 |
+
4. Choose GPU instance (NVIDIA L4 or A100)
|
| 23 |
+
5. Deploy
|
| 24 |
+
|
| 25 |
+
### API Usage
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
import requests
|
| 29 |
+
import base64
|
| 30 |
+
|
| 31 |
+
response = requests.post(
|
| 32 |
+
"YOUR_ENDPOINT_URL",
|
| 33 |
+
headers={"Authorization": "Bearer YOUR_TOKEN"},
|
| 34 |
+
json={
|
| 35 |
+
"inputs": "A beautiful sunset over the ocean",
|
| 36 |
+
"num_inference_steps": 50,
|
| 37 |
+
"guidance_scale": 6.0
|
| 38 |
+
}
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
video_base64 = response.json()["video"]
|
| 42 |
+
video_bytes = base64.b64decode(video_base64)
|
| 43 |
+
|
| 44 |
+
with open("output.mp4", "wb") as f:
|
| 45 |
+
f.write(video_bytes)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Custom Handler
|
| 49 |
+
|
| 50 |
+
The `handler.py` file implements the `EndpointHandler` class required for custom inference.
|
| 51 |
+
See the [HuggingFace documentation](https://huggingface.co/docs/inference-endpoints/guides/custom_handler) for more details.
|