mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-06 06:41:30 +00:00
Split out worker related things to a separate service definition.
This commit is contained in:
@ -1,25 +1,11 @@
|
||||
#include "host.grpc.pb.h"
|
||||
#include "model.grpc.pb.h"
|
||||
#include "image_generation.grpc.pb.h"
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
|
||||
using namespace gay::pizza::stable::diffusion;
|
||||
|
||||
int CompareModelInfoByLoadedFirst(ModelInfo& left, ModelInfo& right) {
|
||||
if (left.is_loaded() && right.is_loaded()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (left.is_loaded()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (right.is_loaded()) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto channel = grpc::CreateChannel("localhost:4546", grpc::InsecureChannelCredentials());
|
||||
auto modelService = ModelService::NewStub(channel);
|
||||
@ -34,9 +20,5 @@ int main() {
|
||||
for (const auto &item: models) {
|
||||
std::cout << "Model Name: " << item.name() << std::endl;
|
||||
}
|
||||
|
||||
std::sort(models.begin(), models.end(), CompareModelInfoByLoadedFirst);
|
||||
auto model = models.begin();
|
||||
std::cout << "Chosen Model: " << model->name() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user