Working C++ Sample

This commit is contained in:
2023-05-01 18:05:47 -07:00
parent 28ebb29a80
commit 7325f96b67
5 changed files with 26 additions and 14 deletions

23
Clients/Cpp/sample.cpp Normal file
View 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;
}