krassowski / jupyterlab-transformers-completer

Inline completion provider using tranformers.js for JupyterLab
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

JupyterLite demo #3

Open jtpio opened 9 months ago

jtpio commented 9 months ago

I was curious to see if such extension would work in JupyterLite as well, since there is no real server logic except for setting the proper headers.

To try it out:

import http.server
import socketserver

PORT = 8000

class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
        self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
        super().end_headers()

Handler = MyHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
    print(f"Serving at port {PORT}")
    httpd.serve_forever()

I had to trigger the download of the models by going to the settings, not sure it's an issue with the JupyterLite build or a transient issue.

But after that it seems to be working fine :tada:

jupyterlite-browser-transformers.webm

jtpio commented 9 months ago

To set up a proper demo on this repository, we could wait for https://github.com/jupyterlite/jupyterlite/pull/1263 to first be merged and released in a 0.3.0a0 (built on top of JupyterLab 4.1 and Notebook 7.1).

jtpio commented 6 months ago

Just checked with jupyterlite==0.3.0a0 and still working as above (but still after changing the settings via the Setting Editor):

jupyterlite-inline-completer.webm