mirror of
https://gitlab.com/niansa/anyproc.git
synced 2025-03-06 20:49:24 +01:00
33 lines
821 B
C++
33 lines
821 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;
|
|
};
|
|
|
|
Dictionary dict("13B-ggml-model-quant.bin");
|
|
for (;;) {
|
|
std::string what;
|
|
std::cout << "What: " << std::flush;
|
|
std::getline(std::cin, what);
|
|
for (;;) {
|
|
std::string word;
|
|
std::cout << "\rWord: " << std::flush;
|
|
std::getline(std::cin, word);
|
|
if (word.empty()) break;
|
|
dict.lookup(word, what, progress_indicator, result_printer);
|
|
}
|
|
}
|
|
}
|