Android Remote GPT by Jonathan Germain Copyright 2023 Released under the GNU GPL Version 3
AndroidRemoteGPT is an android frontend for chatbots running on remote servers. It is an Android/Termux miniapp that provides a convenient way to access a chatbot or other inference engine running on a remote server via ssh. It is targeted towards users of open source generative AI models such as those provided via gpt4all.
AndroidRemoteGPT requires both Android and Termux. It also requires Termux:GUI. Because of an ongoing problem with signing of the F-droid Termux:GUI package, you must use the github Termux release rather than the F-droid Termux release. Versions of Termux from Google Play should never be used as they are insecure and will not be patched.
This software is built for a client/server model. It requires a server on which inference takes place. As of December 2023, there are a variety of open source models and architectures available that can be run on linux. Instructions will be provided for gpt4all, but the frontend can be used with many different backends.
host yourserver
user aiuser
hostname yourserver.com
identityfile ~/.ssh/id
Installation is complete. Now, you can run "python AndroidRemoteGPT.py"
useradd aiuser
mkdir /home/aiuser
chown aiuser.aiuser /home/aiuser
pip install gpt4all
pip uninstall gpt4all
pip install typer
git clone --recurse-submodules https://github.com/nomic-ai/gpt4all
cd gpt4all/gpt4all-backend/
mkdir build
cd build
cmake ..
cmake --build . --config Release
cd ~/gpt4all/gpt4all-bindings/python/
pip install -e .
mkdir ~/.cache
mkdir ~/.cache/gpt4all
cd ~/.cache/gpt4all
ln -s /where/you/store/your/models/* .
#!/bin/sh
python3 ~/gpt4all/gpt4all-bindings/cli/app.py repl --model /wherever/you/put/your/model.gguf
Optionally, you may include "-t (# of threads)" and "-d gpu" or "-d nvidia" if you have a video card that you wish to use.
First, access the configuration page and ensure that your server information is correct. The next command indicator (NCI) and startup sequence are particularly important. The startup sequence is a list of shell commands to run on the server in order to reach the inference interface. The NCI tells the frontend when the chatbot has finished its answer. For gpt4all version 1.0.2, the NCI is the single character "⇢"
Then, go back to the main page and click "connect".
The intro screen should appear. You can then enter your query in the box at the top of the screen and click request to send the query. Note that you must click "request"; pressing enter alone will not send the query.
Secure communication is complex. Openssh is one of the most heavily tested programs in the field; I fear that any less heavily tested ssh implementation will introduce security-related bugs that I don't have the bandwidth to manage.
Yes. If you are pulling models from huggingface and writing your own python scripts to run inference or you use models other than chatbots, this will work. Just be sure to change the next command indicator when you change systems.