Skip to content

Commit f543155

Browse files
committed
refactor: Remove superflous function
1 parent 593bd1a commit f543155

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

examples/server/server.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ inline void signal_handler(int signal) {
364364
shutdown_handler(signal);
365365
}
366366

367-
std::string format_model_id(std::filesystem::path path) {
368-
std::string stem = path.stem();
369-
return stem;
370-
}
371-
372367
int main(int argc, const char ** argv) {
373368
int default_n_threads = std::max((int)std::thread::hardware_concurrency(), 1);
374369
int default_http_threads = std::max((int)std::thread::hardware_concurrency() - 1, 3);
@@ -451,7 +446,7 @@ int main(int argc, const char ** argv) {
451446
if (std::filesystem::is_directory(model_path)) {
452447
for (auto const &entry : std::filesystem::directory_iterator(model_path)) {
453448
if (!entry.is_directory()) {
454-
const std::string id = format_model_id(entry.path());
449+
const std::string id = entry.path().stem();
455450
model_map[id] = entry.path().string();
456451
}
457452
}
@@ -461,7 +456,7 @@ int main(int argc, const char ** argv) {
461456
}
462457
} else {
463458
const std::filesystem::path path = model_path;
464-
model_map[format_model_id(path)] = path;
459+
model_map[path.stem()] = path;
465460
}
466461
auto model_creation = std::chrono::duration_cast<std::chrono::seconds>(
467462
std::chrono::system_clock::now().time_since_epoch())

0 commit comments

Comments
 (0)