You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before using the library, make sure to set your RunwayML API key:
32
-
33
-
```swift
34
-
RunwayML.apiKey="YOUR_API_KEY_HERE"
35
-
```
36
-
37
-
**Important Note:** This library is intended for quick prototyping and development purposes only. For production use, it is highly recommended to implement a more secure and controlled approach to managing API keys, such as using environment variables or a secure key management service.
31
+
This library is intended for quick prototyping and development purposes only. For production use, it is highly recommended to implement a more secure and controlled approach to managing API keys, such as using environment variables or a secure key management service.
38
32
39
33
## Usage
40
34
41
35
Here is a basic example of how to use RunveyKit to generate an image:
42
36
43
-
```swift
37
+
````swift
38
+
// Start of Selection
44
39
importRunveyKit
45
40
46
-
do {
47
-
let prompt ="Dynamic tracking shot: The camera glides through the iconic Shibuya Crossing in Tokyo at night, capturing the bustling intersection bathed in vibrant neon lights. Countless pedestrians cross the wide intersection as towering digital billboards illuminate the scene with colorful advertisements. The wet pavement reflects the dazzling lights, creating a cinematic urban atmosphere."
48
-
let imageURL =URL(string: "https://images.unsplash.com/photo-1542051841857-5f90071e7989?q=80&w=3270&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D")!
49
-
50
-
let taskID =tryawait RunwayML.generateImage(
51
-
prompt: prompt,
52
-
imageURL: imageURL,
53
-
duration: .long, // 10 seconds
54
-
aspectRatio: .widescreen, // 16:9 ratio
55
-
watermark: false,
56
-
seed: 42
57
-
)
58
-
59
-
print("Image generation task started with ID: \(taskID)")
60
-
} catch {
61
-
print("Error generating image: \(error)")
62
-
}
63
-
```
41
+
do {
42
+
let prompt ="Dynamic tracking shot: The camera glides through the iconic Shibuya Crossing in Tokyo at night, capturing the bustling intersection bathed in vibrant neon lights. Countless pedestrians cross the wide intersection as towering digital billboards illuminate the scene with colorful advertisements. The wet pavement reflects the dazzling lights, creating a cinematic urban atmosphere."
43
+
let imageURL =URL(string: "https://images.unsplash.com/photo-1542051841857-5f90071e7989?q=80&w=3270&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D")!
44
+
45
+
let runveyKit =RunveyKit(apiKey: "YOUR_API_KEY_HERE")
46
+
let taskID =tryawait runveyKit.generateImage(
47
+
prompt: prompt,
48
+
imageURL: imageURL,
49
+
duration: .long, // 10 seconds
50
+
aspectRatio: .widescreen, // 16:9 ratio
51
+
)
52
+
53
+
print("Image generation task started with ID: \(taskID)")
54
+
} catch {
55
+
print("Error generating image: \(error)")
56
+
}
64
57
65
58
And here's an example of how to retrieve task details and process them into a human-readable description:
66
59
67
60
```swift
68
61
importRunveyKit
69
62
70
63
do {
64
+
let runveyKit =RunveyKit(apiKey: "YOUR_API_KEY_HERE")
71
65
let taskId ="17f20503-6c24-4c16-946b-35dbbce2af2f"
72
-
let taskDetails =tryawait RunwayML.getTaskDetails(id: taskId)
73
-
let description = RunwayML.processTaskResponse(taskDetails)
74
-
print(description)
66
+
let taskDetails =tryawait RunveyKit.getTaskDetails(id: taskId)
67
+
print(taskDetails)
75
68
} catch {
76
69
print("Error: \(error)")
77
70
}
78
-
```
71
+
````
79
72
80
73
And here's an example of how to cancel or delete a task:
81
74
82
75
```swift
83
76
importRunveyKit
84
77
85
78
do {
79
+
let runveyKit =RunveyKit(apiKey: "YOUR_API_KEY_HERE")
86
80
let taskId ="17f20503-6c24-4c16-946b-35dbbce2af2f"
87
-
tryawaitRunwayML.cancelOrDeleteTask(id: taskId)
81
+
tryawaitRunveyKit.cancelOrDeleteTask(id: taskId)
88
82
print("Task \(taskId) has been successfully canceled or deleted.")
89
83
} catch {
90
84
print("Error canceling or deleting task: \(error)")
0 commit comments