Job management and preparation for multi-hosting.

This commit is contained in:
2023-05-08 16:06:07 -07:00
parent a2d9e14f3a
commit ace2c07aa1
30 changed files with 3879 additions and 2307 deletions

View File

@ -1,10 +1,25 @@
#include "StableDiffusion.pb.h"
#include "StableDiffusion.grpc.pb.h"
#include "host.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);
@ -19,5 +34,9 @@ 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;
}