Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,102 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
# Dream Machine API
|
6 |
+
|
7 |
+
**Model Page:** [Dream Machine API](https://piapi.ai/dream-machine-api)
|
8 |
+
|
9 |
+
This model card illustartes the steps to use Dream Machine API endpoint.
|
10 |
+
You can also check out other model cards:
|
11 |
+
|
12 |
+
- [Midjourney API](https://huggingface.co/PiAPI/Midjourney-API)
|
13 |
+
- [Faceswap API](https://huggingface.co/PiAPI/Faceswap-API)
|
14 |
+
- [Suno API](https://huggingface.co/PiAPI/Suno-API)
|
15 |
+
|
16 |
+
**Model Information**
|
17 |
+
|
18 |
+
Dream Machine, created by Luma Labs, is an advanced AI model that swiftly produces high-quality, realistic videos from text and images. These videos boast physical accuracy, consistent characters, and naturally impactful shots. Although Luma Lab doesn’t currently provide a Dream Machine API within their Luma API suite, PiAPI has stepped up to develop the unofficial Dream Machine API. This enables developers globally to integrate cutting-edge text-to-video and image-to-video generation into their applications or platforms.
|
19 |
+
|
20 |
+
## Usage Steps
|
21 |
+
|
22 |
+
Below we share the code snippets on how to use Dream Machine API's Video Generation endpoint.
|
23 |
+
- The programming language is Python
|
24 |
+
|
25 |
+
**Create a task ID from the Video Generation endpoint**
|
26 |
+
|
27 |
+
<pre><code class="language-python">
|
28 |
+
<span class="hljs-keyword">import</span> http.client
|
29 |
+
|
30 |
+
conn = http.client.HTTPSConnection(<span class="hljs-string">"api.piapi.ai"</span>)
|
31 |
+
|
32 |
+
payload = <span class="hljs-string">"{\n \"prompt\": \"dog running\",\n \"expand_prompt\": true\n}"</span>
|
33 |
+
|
34 |
+
headers = {
|
35 |
+
<span class="hljs-built_in">'X-API-Key': "{{x-api-key}}"</span>, //Insert your API Key here
|
36 |
+
<span class="hljs-built_in">'Content-Type': "application/json"</span>,
|
37 |
+
<span class="hljs-built_in">'Accept': "application/json"</span>
|
38 |
+
}
|
39 |
+
|
40 |
+
conn.request("POST", "/api/luma/v1/video", payload, headers)
|
41 |
+
|
42 |
+
res = conn.getresponse()
|
43 |
+
data = res.read()
|
44 |
+
|
45 |
+
<span class="hljs-keyword">print</span>(data.decode("utf-8"))
|
46 |
+
</code></pre>
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
**Retrieve the task ID**
|
51 |
+
|
52 |
+
<pre><code class="language-python">
|
53 |
+
{
|
54 |
+
<span class="hljs-built_in">"code"</span>: 200,
|
55 |
+
<span class="hljs-built_in">"data"</span>: {
|
56 |
+
<span class="hljs-built_in">"task_id"</span>: "6c4*****************aaaa" //Record the taskID provided in your response terminal
|
57 |
+
},
|
58 |
+
<span class="hljs-built_in">"message"</span>: "success"
|
59 |
+
}
|
60 |
+
</code></pre>
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
**Insert the Video Generation task ID into the fetch endpoint**
|
65 |
+
|
66 |
+
<pre><code class="language-python">
|
67 |
+
<span class="hljs-keyword">import</span> http.client
|
68 |
+
|
69 |
+
conn = http.client.HTTPSConnection(<span class="hljs-string">"api.piapi.ai"</span>)
|
70 |
+
|
71 |
+
|
72 |
+
headers = {
|
73 |
+
<span class="hljs-built_in">{ 'Accept': "application/json" }</span>,
|
74 |
+
}
|
75 |
+
|
76 |
+
conn.request("GET", "/api/luma/v1/video/task_id", headers=headers) //Replace the "task_id" with your task ID
|
77 |
+
|
78 |
+
res = conn.getresponse()
|
79 |
+
data = res.read()
|
80 |
+
|
81 |
+
<span class="hljs-keyword">print</span>(data.decode("utf-8"))
|
82 |
+
</code></pre>
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
**For fetch endpoint responses** - Refer to our [documentation](https://piapi.ai/docs) for more detailed information.
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
<br>
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
## Contact us
|
95 |
+
|
96 |
+
Contact us at <a href="mailto:[email protected]">[email protected]</a> for any inquires.
|
97 |
+
|
98 |
+
<br>
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|