Follow us on Twitter and LinkedIn to get the latest updates from the dev team!
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()
Python API documentation
Python modules documentation
Running on Streamlit Cloud:
Project GitHub: https://github.com/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!
previous
AMPL on Google Colab
next
AMPL Modules for Python