Spaces:
Sleeping
Sleeping
Create services/runway.py
Browse files- services/runway.py +16 -0
services/runway.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
def generate_video(prompt):
|
| 5 |
+
res = requests.post(
|
| 6 |
+
"https://api.runwayml.com/v1/generate",
|
| 7 |
+
headers={
|
| 8 |
+
"Authorization": f"Bearer {os.getenv('RUNWAY_API_KEY')}"
|
| 9 |
+
},
|
| 10 |
+
json={
|
| 11 |
+
"prompt": prompt,
|
| 12 |
+
"duration": 5
|
| 13 |
+
}
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
return res.json()["video_url"]
|