In order to set up the local inference API for MagicTable, follow the instructions below:
- Make sure to have Git (and Git Bash for Windows) installed. If you do not have Git, follow the instructions here.
- Make sure to have Conda installed. If you do not have Conda, follow the instructions here.
- Clone this repository using the following command:
git clone https://github.com/poloclub/magictable-api.git
. - Within your terminal, enter the directory containing this project.
- Run the commands within setup.txt in order. If you are using a Windows computer, make sure to run the commands within Git Bash (which should have been automatically downloaded along with git).
Hint: Consult this link for help with installing Git and Conda if you are using a Windows computer.
When you want to stop your inference API, run the following command: conda deactivate
(also found within terminate.txt).
To restart your inference API, run the commands found within run.txt in order.
By default, the MagicTable API uses the CUDA device if available, and otherwise defaults to CPU. If you would like to change your Torch device, alter the below line in app.py:
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
Look here for more information about torch devices.