Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rudrankriyam committed Oct 7, 2024
1 parent ce48d27 commit 47e20d8
Showing 1 changed file with 27 additions and 33 deletions.
60 changes: 27 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RunveyKit is an unofficial Swift SDK for the RunwayML REST API, designed for qui
## Requirements

- Swift 6.0+
- iOS 13.0+, macOS 13.0+, tvOS 13.0+, watchOS 8.0+, visionOS 1.0+
- iOS 14.0+, macOS 13.0+, tvOS 14.0+, watchOS 8.0+, visionOS 1.0+

## Installation

Expand All @@ -26,65 +26,59 @@ dependencies: [
]
```

## Configuration
## Important Note

Before using the library, make sure to set your RunwayML API key:

```swift
RunwayML.apiKey = "YOUR_API_KEY_HERE"
```

**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.
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.

## Usage

Here is a basic example of how to use RunveyKit to generate an image:

```swift
````swift
// Start of Selection
import RunveyKit

do {
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."
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")!

let taskID = try await RunwayML.generateImage(
prompt: prompt,
imageURL: imageURL,
duration: .long, // 10 seconds
aspectRatio: .widescreen, // 16:9 ratio
watermark: false,
seed: 42
)

print("Image generation task started with ID: \(taskID)")
} catch {
print("Error generating image: \(error)")
}
```
do {
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."
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")!

let runveyKit = RunveyKit(apiKey: "YOUR_API_KEY_HERE")
let taskID = try await runveyKit.generateImage(
prompt: prompt,
imageURL: imageURL,
duration: .long, // 10 seconds
aspectRatio: .widescreen, // 16:9 ratio
)

print("Image generation task started with ID: \(taskID)")
} catch {
print("Error generating image: \(error)")
}

And here's an example of how to retrieve task details and process them into a human-readable description:

```swift
import RunveyKit

do {
let runveyKit = RunveyKit(apiKey: "YOUR_API_KEY_HERE")
let taskId = "17f20503-6c24-4c16-946b-35dbbce2af2f"
let taskDetails = try await RunwayML.getTaskDetails(id: taskId)
let description = RunwayML.processTaskResponse(taskDetails)
print(description)
let taskDetails = try await RunveyKit.getTaskDetails(id: taskId)
print(taskDetails)
} catch {
print("Error: \(error)")
}
```
````

And here's an example of how to cancel or delete a task:

```swift
import RunveyKit

do {
let runveyKit = RunveyKit(apiKey: "YOUR_API_KEY_HERE")
let taskId = "17f20503-6c24-4c16-946b-35dbbce2af2f"
try await RunwayML.cancelOrDeleteTask(id: taskId)
try await RunveyKit.cancelOrDeleteTask(id: taskId)
print("Task \(taskId) has been successfully canceled or deleted.")
} catch {
print("Error canceling or deleting task: \(error)")
Expand Down

0 comments on commit 47e20d8

Please sign in to comment.