Can I Install GPU version Pytorch in the app?

Can I Install GPU version Pytorch in the app?

Hi @lyna-tlncgbnn, welcome to the Streamlit community!

Can you be more specific about where you are running the app? On your local machine, yes, you can run a GPU version of PyTorch. Hosting elsewhere, perhaps not.


So,Apps hosted on GitHub are not be able to use cuda?

Hello @lyna-tlncgbnn,

From memory (and the docs) Streamlit Share doesn’t currently support GPU.

As Randy stated, there are not a lot of “easy” options for GPU deployment of Python apps yet (by “easy” I meant Streamlit Share/Heroku/Digital Ocean which are the most used ones right now). You may need to spin your custom AWS/GCP/Azure image for this, maybe by picking a tutorial from the community guide.

For quick demo purposes, I know some users also use colab-everything to run Streamlit from a GPU-powered Colab notebook. Note that Colab and Ngrok (the underlying mechanism for opening your app to the world) are not made to host long-running apps and will reboot now and then.

Have a nice day,
Fanilo :balloon:


In your case, no, apps on Streamlit sharing cannot have GPUs attached to them. In the future, we may provide paid tiers with this sort of functionality.