Skip to content

On Android

Patrick Hammer edited this page Jul 10, 2023 · 7 revisions

First install the "Termux" command line app on your phone. Then enter:

pkg upgrade
pkg i python-pip
pip install wheel
pkg i ninja automake cmake binutils patchelf
pkg i libjpeg-turbo
pip install pillow
CFLAGS=-Wno-implicit-function-declaration MATHLIB=m pip install numpy==1.23.2
pip install pandas
pip install setuptools==59.8.0
pip install meson
pip install meson-python
pip install pybind11
pip install --no-build-isolation pip install contourpy
pip install matplotlib
pip install openai
pip install plotly
pkg install tur-repo
pip install python-scipy
pip install cython
pkg install plotly
pip cache purge
pip install scikit-learn --no-build-isolation
pip install nltk
pkg install git
git clone https://github.com/opennars/NARS-GPT
cd NARS-GPT
sh build.sh

Finally, to have speech output support:

pip install gTTS
pkg install mpv

To utilize it, after line 156, Linux:

answer=RET_DICT["GPT_Answer"]; os.system(f"echo -n '{answer}' | gtts-cli - | ffplay -loglevel quiet -autoexit -nodisp -");

or for Android (same also works on GNU/Linux but ffplay is more commonly pre-installed there):

answer=RET_DICT["GPT_Answer"]; os.system(f"echo -n '{answer}' | gtts-cli - | mpv -");

or for Mac: (as afplay doesn't support streaming)

answer=RET_DICT["GPT_Answer"]; os.system(f"echo -n '{answer}' | gtts-cli - > SPEECH && afplay SPEECH && rm SPEECH");

Clone this wiki locally