Create I2v
Browse files
I2v
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import json
|
| 3 |
+
import base64
|
| 4 |
+
|
| 5 |
+
url = "https://api.minimaxi.chat/v1/video_generation"
|
| 6 |
+
api_key="your api_key"
|
| 7 |
+
|
| 8 |
+
#base64
|
| 9 |
+
with open(f"your_file_path", "rb") as image_file:
|
| 10 |
+
data = base64.b64encode(image_file.read()).decode('utf-8')
|
| 11 |
+
|
| 12 |
+
payload = json.dumps({
|
| 13 |
+
"model": "video-01",
|
| 14 |
+
"prompt": "On a distant planet, there is a MiniMax.",
|
| 15 |
+
"first_frame_image":f"data:image/jpeg;base64,{image_file}"
|
| 16 |
+
})
|
| 17 |
+
headers = {
|
| 18 |
+
'authorization': f'Bearer {api_key}',
|
| 19 |
+
'Content-Type': 'application/json'
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
response = requests.request("POST", url, headers=headers, data=payload)
|
| 23 |
+
|
| 24 |
+
print(response.text)
|