AMPL on Streamlit Cloud#
Since AMPL and all Solvers are now available as Python Packages. To use them in streamlit you just need to list the modules in the requirements.txt file as follows:
--index-url https://pypi.ampl.com # AMPL's Python Package Index
--extra-index-url https://pypi.org/simple
ampl_module_base # AMPL
ampl_module_highs # HiGHS solver
ampl_module_gurobi # Gurobi solver
amplpy # Python API for AMPL
and load them in streamlit_app.py:
from amplpy import AMPL
ampl = AMPL()
N-Queens Using AMPL and HiGHS#
Project GitHub: fdabrandao/streamlit-nqueens
Run it locally:
$ git clone https://github.com/fdabrandao/streamlit-nqueens.git
$ cd streamlit-nqueens
$ python -m venv venv
$ sournce venv/bin/activate
$ python -m install -r requirements.txt --upgrade
$ streamlit run streamlit_app.py
Deploy to Streamlit Cloud for free!