Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jr662933/jupyterhub-ai
  • buecker/jupyterhub-ai
  • buecker/jupyterhub
  • sr151511/vennemann
4 results
Show changes
Commits on Source (5)
*env/
.env
...@@ -9,5 +9,5 @@ docker-build-master: ...@@ -9,5 +9,5 @@ docker-build-master:
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE":prod . - docker build --pull -t "$CI_REGISTRY_IMAGE":test .
- docker push "$CI_REGISTRY_IMAGE":prod - docker push "$CI_REGISTRY_IMAGE":test
FROM jupyter/scipy-notebook:hub-1.5.0 FROM jupyter/datascience-notebook:hub-3.1.1
# Install from APT repository
USER root USER root
RUN apt-get update -y
RUN apt-get install -y git
# Install basics COPY requirements.txt environment.yml /tmp/
USER jovyan RUN conda env update -q -f /tmp/environment.yml && \
RUN pip3 install --upgrade pip /opt/conda/bin/pip install -r /tmp/requirements.txt && \
conda clean -y --all && \
conda env export -n "root" && \
jupyter lab build
# Install 'nice to have lab extensions' COPY jupyter_notebook_config.py ${HOME}/.jupyter/
# RUN pip install --upgrade jupyterlab
RUN pip install jupyterlab-git==0.34.0 # copy dash app
RUN pip install jupyterlab-gitlab==3.0.0 COPY app ${HOME}/app/
RUN chown -R jovyan ${HOME}/app/
# bücker # A Jupyterlab for LLM
import sys
sys.path.append("/home/jovyan")
import argparse
import logging
from dash import Dash
from layout import layout
from callbacks import register_callbacks
logging.basicConfig(level=logging.INFO)
# get the correct port from proxy
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int)
args = parser.parse_args()
port: int = args.port
if not port:
raise ValueError(f"Port of proxy server for Dash not found in {args}.")
else:
logging.debug(f"Dash app running on port {port}.")
# define Dash app
app = Dash(
name=__name__,
requests_pathname_prefix="/dash/"
)
# define layout
app.layout = layout
# register all callback functions
register_callbacks(app=app)
# Run Dash app in the notebook
app.run(
jupyter_mode="jupyterlab",
port=port,
host="localhost",
debug=True
)
from dash import (
html,
Dash
)
from dash.dependencies import (
Input,
Output,
State
)
def register_callbacks(app: Dash):
@app.callback(
Output("output-container", "children"),
[Input("send-button", "n_clicks")],
[State("input-text", "value")]
)
def generate_response(n_clicks, input_text):
if n_clicks > 0:
response = "You said: " + input_text
return html.Div(response)
else:
return ""
from dash import (
html,
dcc
)
layout = html.Div(
className="container",
children=[
html.H1("GPT Chat", className="mt-5 mb-4"),
dcc.Textarea(id="input-text", placeholder="Enter your message:", className="form-control mb-3"),
html.Button("Send", id="send-button", n_clicks=0, className="btn btn-primary mb-3"),
html.Div(id="output-container")
]
)
name: "base"
channels:
- defaults
# dependencies:
# - add packages here
# - one per line
prefix: "/opt/conda"
# Configuration file for jupyter-notebook.
c.ServerProxy.servers = {
'dash': {
'command': [
'python',
'app/app.py',
'--port',
'{port}'
],
'absolute_url': False,
'new_browser_tab': False
}
}