mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-05 14:31:32 +00:00
Working C++ Sample
This commit is contained in:
23
Clients/Cpp/sample.cpp
Normal file
23
Clients/Cpp/sample.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "StableDiffusion.pb.h"
|
||||
#include "StableDiffusion.grpc.pb.h"
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
|
||||
using namespace gay::pizza::stable::diffusion;
|
||||
|
||||
int main() {
|
||||
auto channel = grpc::CreateChannel("localhost:4546", grpc::InsecureChannelCredentials());
|
||||
auto modelService = ModelService::NewStub(channel);
|
||||
auto imageGenerationService = ImageGenerationService::NewStub(channel);
|
||||
|
||||
grpc::ClientContext context;
|
||||
|
||||
ListModelsRequest listModelsRequest;
|
||||
ListModelsResponse response;
|
||||
modelService->ListModels(&context, listModelsRequest, &response);
|
||||
auto models = response.available_models();
|
||||
for (const auto &item: models) {
|
||||
std::cout << "Model Name: " << item.name() << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user