4 Commits
Author SHA1 Message Date
SuspiciousActivity 79af2ece97 1.0.6 2026-10-03 17:18:47 +02:00
SuspiciousActivity c2d4e01d0b add signal handlers 2026-10-03 17:18:30 +02:00
SuspiciousActivity da8a4903a7 1.0.5, remove avx512 2026-09-24 23:57:55 +02:00
SuspiciousActivity 6f670860a9 Remove arm64 2026-09-18 19:57:38 +02:00
4 changed files with 16 additions and 10 deletions

No files matched your search

+4
View File
@@ -24,8 +24,12 @@ FetchContent_MakeAvailable(httplib)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
target_compile_options(fasttext-static PRIVATE
-march=x86-64 -mno-avx512f)
add_executable(fasttext_lid_server main.cpp)
target_compile_options(fasttext_lid_server PRIVATE
-march=x86-64 -mno-avx512f)
target_include_directories(fasttext_lid_server PRIVATE ${fasttext_SOURCE_DIR}/src)
target_link_libraries(fasttext_lid_server
+1 -1
View File
@@ -25,4 +25,4 @@ WORKDIR /app
COPY --from=builder /app/build-docker/fasttext_lid_server .
RUN curl --remote-name https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin
CMD ["sh", "-c", "./fasttext_lid_server ${MODEL_FILE:-lid.176.bin} ${PORT:-8080}"]
CMD ["sh", "-c", "exec ./fasttext_lid_server ${MODEL_FILE:-lid.176.bin} ${PORT:-8080}"]
+8
View File
@@ -3,6 +3,9 @@
#include <string>
#include <iostream>
#include <sstream>
#include <csignal>
httplib::Server *g_svr = nullptr;
std::string stripLabel(const std::string &label) {
const std::string prefix = "__label__";
@@ -59,8 +62,13 @@ int main(int argc, char *argv[]) {
res.set_content(result, "application/json");
});
g_svr = &svr;
std::signal(SIGINT, [](int) { if (g_svr) g_svr->stop(); });
std::signal(SIGTERM, [](int) { if (g_svr) g_svr->stop(); });
auto port = std::stoi(argv[2]);
std::cout << "Starting server on port " << port << std::endl;
svr.listen("0.0.0.0", port);
std::cout << "Server stopped" << std::endl;
return 0;
}
+3 -9
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
version=1.0.4
version=1.0.6
image_name="suspiciousactivity/fasttext-lid-server"
# Check git status
@@ -19,18 +19,12 @@ fi
docker build --platform linux/amd64 -t ${image_name}:${version}-amd64 .
docker push ${image_name}:${version}-amd64
# Build ARM64
docker build --platform linux/arm64 -t ${image_name}:${version}-arm64 .
docker push ${image_name}:${version}-arm64
# Create and push manifest
docker manifest create ${image_name}:${version} \
${image_name}:${version}-amd64 \
${image_name}:${version}-arm64
${image_name}:${version}-amd64
docker manifest create ${image_name}:latest \
${image_name}:${version}-amd64 \
${image_name}:${version}-arm64
${image_name}:${version}-amd64
docker manifest push ${image_name}:${version}
docker manifest push ${image_name}:latest