Python library to run streamlit, flask, fastapi, etc on google colab.
Project description
colab_everything
Python library to run streamlit, flask, fastapi, etc on google colab.
Install
pip install colab-everything
How to use
Note: The library is only responsible for port tunneling. So, you will have setup everything required to run your web app. For example; installing all the dependecies, setting up all the environment varibles, etc.
Streamlit app
from colab_everything import ColabStreamlit
ColabStreamlit('app.py') # streamlit app path
Flask app
from colab_everything import ColabFlask
ColabFlask('app.py') # Flask app path
FastAPI app
Note: FastAPI uses uvicorn
, so the syntax is a bit different. You will have to pass only the file name (without extention). For example, pass main
if your app is main.py
.
from colab_everything import ColabFastapi
ColabFastapi('app') # FastAPI app file name
Any other Custom app or command
You can use ColabCustom
to easily run an other app or command.
To be very honest, you will never have to use http.server
because colab already provides a file explorer. The example below is just for demonstration purposes.
Note: The default port is 9999. If you are using any other port then you will have specify it twice; in the command and also in the argument.
## Using default port
from colab_everything import ColabCustom
cmd = 'python -m http.server 9999'
ColabCustom(cmd)
## Using non-default port
from colab_everything import ColabCustom
cmd = 'python -m http.server 10000'
ColabCustom(cmd, port=10000)
I am actively looking for feedbacks and contributions. Feel free to contact me at as.ankursingh3.1@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for colab_everything-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac935466789af4bf0b17b41d1b718b84eef7909713327c864299088e7c7fcd7 |
|
MD5 | 9fe2c6074418b178327db6b2a7394f67 |
|
BLAKE2b-256 | 87333e9fd2ad5603eeba7ce1e54e1dd23dcaf612e515596967444c81177e13fa |