Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/decart/models.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace models {

/// Resolve a realtime model by name.
///
/// Accepts canonical names ("lucy-2.1", "lucy-vton-2",
/// Accepts canonical names ("lucy-2.1", "lucy-2.5", "lucy-vton-2",
/// "lucy-vton-3", "lucy-restyle-2"), server-resolved aliases ("lucy-latest",
/// "lucy-vton-latest", "lucy-restyle-latest"), and deprecated names (which emit
/// no error but resolve to the same stream endpoint).
Expand Down
26 changes: 14 additions & 12 deletions src/models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ constexpr const char* kStreamPath = "/v1/stream";

struct Entry {
const char* name;
int fps;
int width;
int height;
bool canonical; // false for "latest"/deprecated aliases
};

// Realtime model registry. Kept in sync with the shared model list across the
// Decart SDKs. All realtime models stream over `/v1/stream` at 30 fps.
constexpr std::array<Entry, 9> kRealtime = {{
// Decart SDKs. All realtime models stream over `/v1/stream`.
constexpr std::array<Entry, 10> kRealtime = {{
// Canonical
{"lucy-2.1", 1088, 624, true},
{"lucy-vton-2", 1088, 624, true},
{"lucy-vton-3", 1088, 624, true},
{"lucy-restyle-2", 1280, 704, true},
{"lucy-2.1", 30, 1088, 624, true},
{"lucy-2.5", 30, 1088, 624, true},
{"lucy-vton-2", 30, 1088, 624, true},
{"lucy-vton-3", 30, 1088, 624, true},
{"lucy-restyle-2", 30, 1280, 704, true},
// Server-resolved "latest" aliases
{"lucy-latest", 1088, 624, false},
{"lucy-vton-latest", 1088, 624, false},
{"lucy-restyle-latest", 1280, 704, false},
{"lucy-latest", 30, 1088, 624, false},
{"lucy-vton-latest", 30, 1088, 624, false},
{"lucy-restyle-latest", 30, 1280, 704, false},
// Deprecated aliases (still accepted)
{"mirage_v2", 1280, 704, false},
{"lucy-2.1-vton-2", 1088, 624, false},
{"mirage_v2", 30, 1280, 704, false},
{"lucy-2.1-vton-2", 30, 1088, 624, false},
}};

const Entry* find(std::string_view name) {
Expand All @@ -43,7 +45,7 @@ const Entry* find(std::string_view name) {
}

ModelDefinition toDefinition(const Entry& e) {
return ModelDefinition{e.name, kStreamPath, 30, e.width, e.height};
return ModelDefinition{e.name, kStreamPath, e.fps, e.width, e.height};
}

} // namespace
Expand Down
9 changes: 8 additions & 1 deletion tests/test_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ TEST_CASE("realtime() resolves canonical models with correct geometry") {
auto vton = models::realtime("lucy-vton-3");
CHECK(vton.width == 1088);
CHECK(vton.height == 624);

auto lucy25 = models::realtime("lucy-2.5");
CHECK(lucy25.name == "lucy-2.5");
CHECK(lucy25.urlPath == "/v1/stream");
CHECK(lucy25.fps == 30);
CHECK(lucy25.width == 1088);
CHECK(lucy25.height == 624);
}

TEST_CASE("realtime() accepts latest and deprecated aliases") {
Expand All @@ -41,6 +48,6 @@ TEST_CASE("realtime() throws ModelNotFound for unknown names") {
TEST_CASE("listRealtime() honors canonicalOnly") {
auto all = models::listRealtime(/*canonicalOnly=*/false);
auto canonical = models::listRealtime(/*canonicalOnly=*/true);
CHECK(canonical.size() == 4);
CHECK(canonical.size() == 5);
CHECK(all.size() > canonical.size());
}
Loading