mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-04 14:01:32 +00:00
Formatting, linting, and hopefully a CI build.
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user