Formatting, linting, and hopefully a CI build.

This commit is contained in:
2023-04-22 15:43:22 -07:00
parent 2759c8d7fb
commit 4bf5ceefbe
13 changed files with 117 additions and 68 deletions

View File

@ -1,18 +1,18 @@
import Foundation
import StableDiffusionProtos
import NIO
import System
import GRPC
import NIO
import StableDiffusionProtos
import System
let group = PlatformSupport.makeEventLoopGroup(loopCount: 1)
defer {
try? group.syncShutdownGracefully()
try? group.syncShutdownGracefully()
}
let channel = try GRPCChannelPool.with(
target: .host("localhost", port: 4546),
transportSecurity: .plaintext,
eventLoopGroup: group
target: .host("localhost", port: 4546),
transportSecurity: .plaintext,
eventLoopGroup: group
)
let modelService = SdModelServiceAsyncClient(channel: channel)
@ -27,14 +27,14 @@ Task { @MainActor in
request.modelName = modelInfo.name
})
print("Loaded model.")
print("Generating image...")
let request = SdGenerateImagesRequest.with {
$0.modelName = modelInfo.name
$0.prompt = "cat"
$0.imageCount = 1
}
let response = try await imageGeneratorService.generateImage(request)
print("Generated image.")
print(response)
@ -43,4 +43,5 @@ Task { @MainActor in
exit(1)
}
}
dispatchMain()