diff --git a/Clients/Cpp/CMakeLists.txt b/Clients/Cpp/CMakeLists.txt index a1ec46d..0b5323c 100644 --- a/Clients/Cpp/CMakeLists.txt +++ b/Clients/Cpp/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(gRPC CONFIG REQUIRED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -add_library(sdrpc src/StableDiffusion.proto) +add_library(sdrpc StableDiffusion.proto) get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION) @@ -17,6 +17,6 @@ protobuf_generate(TARGET sdrpc LANGUAGE grpc target_include_directories(sdrpc PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(sdrpc PUBLIC protobuf::libprotobuf gRPC::grpc gRPC::grpc++) -add_executable(sdrpc_sample src/sample.cpp) +add_executable(sdrpc_sample sample.cpp) target_include_directories(sdrpc_sample PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(sdrpc_sample PRIVATE sdrpc) diff --git a/Clients/Cpp/StableDiffusion.proto b/Clients/Cpp/StableDiffusion.proto new file mode 120000 index 0000000..4cddda6 --- /dev/null +++ b/Clients/Cpp/StableDiffusion.proto @@ -0,0 +1 @@ +../../Common/StableDiffusion.proto \ No newline at end of file diff --git a/Clients/Cpp/sample.cpp b/Clients/Cpp/sample.cpp new file mode 100644 index 0000000..f8bba1a --- /dev/null +++ b/Clients/Cpp/sample.cpp @@ -0,0 +1,23 @@ +#include "StableDiffusion.pb.h" +#include "StableDiffusion.grpc.pb.h" + +#include + +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; +} diff --git a/Clients/Cpp/src/StableDiffusion.proto b/Clients/Cpp/src/StableDiffusion.proto deleted file mode 120000 index 2839d83..0000000 --- a/Clients/Cpp/src/StableDiffusion.proto +++ /dev/null @@ -1 +0,0 @@ -../../../Common/StableDiffusion.proto \ No newline at end of file diff --git a/Clients/Cpp/src/sample.cpp b/Clients/Cpp/src/sample.cpp deleted file mode 100644 index b34abd8..0000000 --- a/Clients/Cpp/src/sample.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -using namespace gay::pizza::stable::diffusion; - -int main() { - ModelInfo info; - info.set_name("anything-4.5"); - std::cout << info.DebugString() << std::endl; - return 0; -}