Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: make use of the --file option #1679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KaiHa
Copy link

@KaiHa KaiHa commented Dec 22, 2023

Append the recognized commands to the output file (option --file). One command per line in the format probability<TAB>command.

With this you are able to do things like the following:

# Create a named pipe for later usage
mkfifo ./myfifo
# Let awk read from the named pipe and if the probability is > 0.9 execute the command in bash
awk -F'\t' '{if ($1 > 0.9) { printf("%s &\n", $2) | "bash" }}' ./myfifo
# Run ./command and let it write the recognized commands to the named pipe
./command --commands <(echo -e "emacs\nfirefox\nfoot\n") -m ./ggml-base.bin --file ./myfifo

A word of warning, I only know enough C++ to be dangerous.

Append the recognized commands to the output file (option `--file`).
One command per line in the format "probability<TAB>command".

With this you are able to do things like the following:

  # Create a named pipe for later usage
  mkfifo ./myfifo
  # Let awk read from the named pipe and if the probability is > 0.9 execute the command in bash
  awk -F'\t' '{if ($1 > 0.9) { printf("%s &\n", $2) | "bash" }}' ./myfifo
  # Run ./command and let it write the recognized commands to the named pipe
  ./command --commands <(echo -e "emacs\nfirefox\nfoot\n") -m ./ggml-base.bin --file ./myfifo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant