mirror of
https://gitlab.com/niansa/anyproc.git
synced 2025-03-06 20:49:24 +01:00
33 lines
852 B
C++
33 lines
852 B
C++
#include "anyproc.hpp"
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include <justlm.hpp>
|
|
|
|
|
|
|
|
int main() {
|
|
const auto progress_indicator = [](float progress) {
|
|
std::cout << unsigned(progress) << "% \r" << std::flush;
|
|
return true;
|
|
};
|
|
const auto result_printer = [](const char *token) {
|
|
std::cout << token << std::flush;
|
|
return true;
|
|
};
|
|
|
|
Translator translator("13B-ggml-model-quant.bin");
|
|
for (;;) {
|
|
std::string language;
|
|
std::cout << "Language: " << std::flush;
|
|
std::getline(std::cin, language);
|
|
for (;;) {
|
|
std::string text;
|
|
std::cout << "\rText: " << std::flush;
|
|
std::getline(std::cin, text);
|
|
if (text.empty()) break;
|
|
translator.translate(text, language, progress_indicator, result_printer);
|
|
}
|
|
}
|
|
}
|