From 20b2f7a8b98250ad0c938c33e9a09a2ec9ac0268 Mon Sep 17 00:00:00 2001
From: daxid <david.rouquet@tetras-libre.fr>
Date: Tue, 2 May 2023 12:39:55 +0000
Subject: [PATCH] Add BASE_URL

---
 selfContainedDemo.ipynb | 53 ++++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 11 deletions(-)

diff --git a/selfContainedDemo.ipynb b/selfContainedDemo.ipynb
index 1e21c23..735204d 100644
--- a/selfContainedDemo.ipynb
+++ b/selfContainedDemo.ipynb
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "id": "0d91640d-23ea-4079-b765-2eea030926c5",
    "metadata": {},
    "outputs": [],
@@ -39,9 +39,10 @@
     "sys.path.insert(0, os.path.abspath(TENET_PATH))\n",
     "import tenet\n",
     "\n",
+    "BASE_URL = 'https://mars.tetras-lab.io'\n",
     "AMR_MODEL_PATH=\"/opt/lib/TetrasMARS/corpus/cm-tool/amrModel/model_parse_xfm_bart_large-v0_1_0\"\n",
     "MEDIA_PATH = \"/opt/dashboards/media/17/\"\n",
-    "MEDIA_URL = \"https://unsel.tetras-lab.io/dashboard/17/media/\"\n",
+    "MEDIA_URL = BASE_URL+\"/dashboard/17/media/\"\n",
     "ROOT_PATH = \"/opt/dashboards/TetrasMARS/tetras-mars-demo-prod/\"\n",
     "AMRLD_PATH = \"/opt/lib/TetrasMARS/amrld/\"\n",
     "owl2vowlPath = '/opt/dashboards/tools/owl2vowl_0.3.7/owl2vowl.jar'\n",
@@ -56,7 +57,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "id": "295e4aef-bbd8-40f0-8d84-0b8032b7b039",
    "metadata": {},
    "outputs": [],
@@ -73,7 +74,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 3,
    "id": "a410a6b3-865d-441f-9b83-90a1badae291",
    "metadata": {},
    "outputs": [],
@@ -130,7 +131,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 4,
    "id": "5fd9cf0c-990a-4776-b206-8cc94f87c7be",
    "metadata": {},
    "outputs": [],
@@ -174,12 +175,42 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 5,
    "id": "0cd10e8b-cf7a-4fd4-b8ac-540fcb943325",
    "metadata": {
     "tags": []
    },
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Dash is running on https://mars.tetras-lab.io:443/jupyter/app_proxy/8050/\n",
+      "\n"
+     ]
+    },
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"2000\"\n",
+       "            src=\"https://mars.tetras-lab.io:443/jupyter/app_proxy/8050/jupyter/app_proxy/8050/\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x7f3acf0ae850>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
    "source": [
     "##################################################################################################\n",
     "# THE FOLLOWING PART IS SPECIFIC TO TÉTRAS LAB\n",
@@ -277,7 +308,7 @@
     "        else:\n",
     "            feedbackStr = \"Download Zip File\"\n",
     "        #show_svg(svgPath) \n",
-    "        #display(IFrame('''https://unsel.tetras-lab.io/webvowl/#{}\">'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")),800,1200))\n",
+    "        #display(IFrame(BASE_URL+'''/webvowl/#{}\">'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")),800,1200))\n",
     "        return  [dbc.Row([dbc.Col(),\n",
     "        dbc.Col(dbc.Accordion(  \n",
     "            [dbc.AccordionItem(\n",
@@ -292,9 +323,9 @@
     "                [\n",
     "                    \"You can click a class to see its instances in the right panel, they are not shown in the graph.\",\n",
     "                    html.Br(),\n",
-    "                    html.A(children=\"Open ontology browser in separate tab.\", href='''https://unsel.tetras-lab.io/webvowl/#{}'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")), target=\"_blank\",id=\"webvowl-link\"),\n",
+    "                    html.A(children=\"Open ontology browser in separate tab.\", href=BASE_URL+'''/webvowl/#{}'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")), target=\"_blank\",id=\"webvowl-link\"),\n",
     "                    html.Br(),\n",
-    "                    html.Iframe(src='''https://unsel.tetras-lab.io/webvowl/#{}'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")),style={\"height\": \"800px\", \"width\": \"100%\"}),\n",
+    "                    html.Iframe(src=BASE_URL+'''/webvowl/#{}'''.format(webvowlFilePath.replace(\"/opt/webvowl/\",\"\").replace(\".json\",\"\")),style={\"height\": \"800px\", \"width\": \"100%\"}),\n",
     "                ],\n",
     "                title=\"Browse ontology\", item_id='onto'\n",
     "            )\n",
@@ -310,7 +341,7 @@
     "#)\n",
     "#def func(n_clicks):\n",
     "#    if n_clicks > 0:\n",
-    "#        return dcc.send_file('https://unsel.tetras-lab.io/dashboard/17/media/9f7287d0-e7b2-4328-9137-7a7c44225b68.zip')\n",
+    "#        return dcc.send_file(BASE_URL+'/dashboard/17/media/9f7287d0-e7b2-4328-9137-7a7c44225b68.zip')\n",
     "    \n",
     "\n",
     "    \n",
-- 
GitLab