Compare commits
2
Commits
da8a4903a7
...
79af2ece97
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79af2ece97 | ||
|
|
c2d4e01d0b |
No files matched your search
+1
-1
@@ -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}"]
|
||||
@@ -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;
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
version=1.0.5
|
||||
version=1.0.6
|
||||
image_name="suspiciousactivity/fasttext-lid-server"
|
||||
|
||||
# Check git status
|
||||
|
||||
Reference in new issue
Block a user