Upload examples/sora2_example.py with huggingface_hub
Browse files- examples/sora2_example.py +27 -0
examples/sora2_example.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Sora 2 Video Generation API Example via NexaAPI
|
| 3 |
+
Get your free API key at: https://nexa-api.com
|
| 4 |
+
Install: pip install nexaapi
|
| 5 |
+
"""
|
| 6 |
+
from nexaapi import NexaAPI
|
| 7 |
+
|
| 8 |
+
# Initialize client - get your key at https://nexa-api.com
|
| 9 |
+
client = NexaAPI(api_key='YOUR_API_KEY')
|
| 10 |
+
|
| 11 |
+
# Generate a short video
|
| 12 |
+
video = client.videos.generate(
|
| 13 |
+
model='sora-2',
|
| 14 |
+
prompt='A timelapse of a blooming flower in a garden, cinematic quality',
|
| 15 |
+
duration=5 # seconds
|
| 16 |
+
)
|
| 17 |
+
print("Sora 2 - Generated Video URL:")
|
| 18 |
+
print(video.data[0].url)
|
| 19 |
+
|
| 20 |
+
# Marketing clip
|
| 21 |
+
marketing_video = client.videos.generate(
|
| 22 |
+
model='sora-2',
|
| 23 |
+
prompt='A robot walking through a neon-lit city at night, futuristic aesthetic',
|
| 24 |
+
duration=8
|
| 25 |
+
)
|
| 26 |
+
print("\nMarketing Video URL:")
|
| 27 |
+
print(marketing_video.data[0].url)
|