Create a bridge your between local and cloud. With single line of code.
AI and ML models on local machine is like a hell. We know that and we motivated to create a bridge between local and cloud.
Prerequisite You should have magicpoint.yaml to use bridge!
Letβs continue with an example. If you have an magicpoint application like that;
example_app.py
Copy
from magicpoint import Magicpoint, Request, Responsefrom diffusers import StableDiffusionPipeline import torchimport osapp = Magicpoint("MyCoolApp π")@app.initdef init(): model = StableDiffusionPipeline.from_pretrained( "runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16, cache_dir="./models", # Add your own auth token from Huggingface use_auth_token=os.environ["HUGGINGFACE_API_KEY"], ).to("cuda") context = { "model": model } return context@app.background_task("/generate_async")def generate_image_async(context, request): # do smth return@app.training("/background")def training(context : dict, request : Request) -> None: # do smth returnapp.serve()
If you are working on training method you can run following commands to serve on cloud:
Copy
magicpoint bridge example_app.py:training
Output will shown like that;
Copy
[β] Creating bridge...[β] Deploying magicpoint magic into the bridge...[β] Setup completed Your bridge URL is ready: https://1019.tech/bridge/eliminate-retirement-x1723xn