Skip to main content

Helps you run localhost stuff on colab

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localhost-on-colab-0.0.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

localhost_on_colab-0.0.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file localhost-on-colab-0.0.0.tar.gz.

File metadata

  • Download URL: localhost-on-colab-0.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for localhost-on-colab-0.0.0.tar.gz
Algorithm Hash digest
SHA256 b24289c4fd730785ec344ff461041991357519e1fbf28ab184f635740f4c4482
MD5 7cee6f3632c8ac20609d3e42e3809343
BLAKE2b-256 0e2551b3793a421b62fa19ee71b5c25ad5f655eaf2b4ed760bf3af963fcdcd0e

See more details on using hashes here.

File details

Details for the file localhost_on_colab-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: localhost_on_colab-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for localhost_on_colab-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9724c90f3447822d77d6958ca9850544220208de8f19774cbcc6b78c44c9fba2
MD5 e87f8821ab55d96969e29d7de1007bca
BLAKE2b-256 b032d680365525f4a71fc68bdce5ae16f3f04fe0f61cfe96757a2a7f475281be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page