localhost-on-colab
Thin wrapper to help you run localhost stuff on colab.
Running webapps(or other localhost stuff) on the colab GPU is much easier with this module.
Usage
from localhost_on_colab.core import LocalHostOnColab
bridge = LocalHostOnColab()
url = bridge.run(
function = some_function,
kwargs = {},
port = 5000
)
print(url)
Flask Example
Imports + mininmal flask app
from flask import Flask
from localhost_on_colab.core import LocalHostOnColab
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello :)"
Running the bridge
bridge = LocalHostOnColab()
url = bridge.run(
function = app.run,
kwargs = {'port': 8989},
port = 8989,
)
print(url)
FastAPI example
Imports + mininmal fastAPI app
import uvicorn
from fastapi import FastAPI
from localhost_on_colab.core import LocalHostOnColab
app = FastAPI()
@app.get('/')
async def home():
return "Hello Santa"
Running the bridge
bridge2 = LocalHostOnColab()
url = bridge2.run(
function = uvicorn.run,
kwargs = {
'app': app,
'port': 9999
},
port = 9999,
)
print(url)
Metadata
Release files for localhost-on-colab 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| localhost-on-colab-0.0.0.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| localhost_on_colab-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / localhost-on-colab-0.0.0.tar.gz
| Download URL | localhost-on-colab-0.0.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b24289c4fd730785ec344ff461041991357519e1fbf28ab184f635740f4c4482
|
|
BLAKE2b-256 checksum How to use checksums |
0e2551b3793a421b62fa19ee71b5c25ad5f655eaf2b4ed760bf3af963fcdcd0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / localhost_on_colab-0.0.0-py3-none-any.whl
| Download URL | localhost_on_colab-0.0.0-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9724c90f3447822d77d6958ca9850544220208de8f19774cbcc6b78c44c9fba2
|
|
BLAKE2b-256 checksum How to use checksums |
b032d680365525f4a71fc68bdce5ae16f3f04fe0f61cfe96757a2a7f475281be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|