LennardZuendorf commited on
Commit
b3b602a
1 Parent(s): 19a4399

feat: implementing controller and other updates

Browse files
.dockerignore CHANGED
@@ -4,3 +4,5 @@ Dockerfile-Base
4
  Dockerfile-Light
5
  entrypoint.sh
6
  railway.json
 
 
 
4
  Dockerfile-Light
5
  entrypoint.sh
6
  railway.json
7
+ /components/
8
+ /components/*
.idea/thesis-webapp.iml CHANGED
@@ -1,7 +1,9 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <module type="PYTHON_MODULE" version="4">
3
  <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
 
 
5
  <orderEntry type="jdk" jdkName="Python 3.11.6 WSL (Ubuntu): (/home/lennard/.virtualenvs/thesis/bin/python)" jdkType="Python SDK" />
6
  <orderEntry type="sourceFolder" forTests="false" />
7
  </component>
 
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <module type="PYTHON_MODULE" version="4">
3
  <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <sourceFolder url="file://$MODULE_DIR$/components/iframe/backend" isTestSource="false" />
6
+ </content>
7
  <orderEntry type="jdk" jdkName="Python 3.11.6 WSL (Ubuntu): (/home/lennard/.virtualenvs/thesis/bin/python)" jdkType="Python SDK" />
8
  <orderEntry type="sourceFolder" forTests="false" />
9
  </component>
{controller → backend}/__init__.py RENAMED
File without changes
{controller → backend}/controller.py RENAMED
@@ -4,14 +4,7 @@ import gradio as gr
4
  # internal imports
5
  from model import mistral, llama2 as llama
6
 
7
- # default model settings
8
- model_temperature = 0.7
9
- model_max_new_tokens = 100
10
- model_top_p = 0.95
11
- model_repetition_penalty = 1.1
12
-
13
  def interference(prompt, history,system_prompt, model, xai, ):
14
- global model_temperature, model_max_new_tokens, model_top_p, model_repetition_penalty
15
 
16
  if system_prompt == "":
17
  system_prompt = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe."
@@ -20,11 +13,9 @@ def interference(prompt, history,system_prompt, model, xai, ):
20
 
21
  match model:
22
  case "Mistral":
23
- prompt_output, history_output = mistral.chat(prompt, history, model_temperature, model_max_new_tokens,
24
- model_top_p, model_repetition_penalty, system_prompt)
25
  case "LlaMa 2":
26
- prompt_output, history_output = llama.chat(prompt, history, model_temperature, model_max_new_tokens,
27
- model_top_p, model_repetition_penalty, system_prompt)
28
  case _:
29
  gr.Warning(f"There was an error in the selected model. It is \"{model}\"")
30
  return "", "", ""
 
4
  # internal imports
5
  from model import mistral, llama2 as llama
6
 
 
 
 
 
 
 
7
  def interference(prompt, history,system_prompt, model, xai, ):
 
8
 
9
  if system_prompt == "":
10
  system_prompt = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe."
 
13
 
14
  match model:
15
  case "Mistral":
16
+ prompt_output, history_output = mistral.chat(prompt, history, system_prompt)
 
17
  case "LlaMa 2":
18
+ prompt_output, history_output = llama.chat(prompt, history, system_prompt)
 
19
  case _:
20
  gr.Warning(f"There was an error in the selected model. It is \"{model}\"")
21
  return "", "", ""
components/iframe/.gitignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ node_modules
components/iframe/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # gradio_iframe
3
+ A Custom Gradio component.
4
+
5
+ ## Example usage
6
+
7
+ ```python
8
+ import gradio as gr
9
+ from gradio_iframe import iFrame
10
+ ```
components/iframe/backend/gradio_iframe/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ from .iframe import iFrame
3
+
4
+ __all__ = ['iFrame']
components/iframe/backend/gradio_iframe/iframe.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """gr.HTML() component."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Callable
6
+
7
+ from gradio_client.documentation import document, set_documentation_group
8
+
9
+ from gradio.components.base import Component
10
+ from gradio.events import Events
11
+
12
+ set_documentation_group("component")
13
+
14
+
15
+ @document()
16
+ class iFrame(Component):
17
+ """
18
+ Used to display arbitrary iFrame output.
19
+ Preprocessing: this component does *not* accept input.
20
+ Postprocessing: expects a valid iFrame {str}.
21
+
22
+ Demos: text_analysis
23
+ Guides: key-features
24
+ """
25
+
26
+ EVENTS = [Events.change]
27
+
28
+ def __init__(
29
+ self,
30
+ value: str | Callable = "",
31
+ *,
32
+ label: str | None = None,
33
+ every: float | None = None,
34
+ show_label: bool | None = None,
35
+ visible: bool = True,
36
+ elem_id: str | None = None,
37
+ elem_classes: list[str] | str | None = None,
38
+ render: bool = True,
39
+ ):
40
+ """
41
+ Parameters:
42
+ value: Default value. If callable, the function will be called whenever the app loads to set the initial value of the component.
43
+ label: The label for this component. Is used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
44
+ every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
45
+ show_label: This parameter has no effect.
46
+ visible: If False, component will be hidden.
47
+ elem_id: An optional string that is assigned as the id of this component in the iFrame DOM. Can be used for targeting CSS styles.
48
+ elem_classes: An optional list of strings that are assigned as the classes of this component in the iFrame DOM. Can be used for targeting CSS styles.
49
+ render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
50
+ """
51
+ super().__init__(
52
+ label=label,
53
+ every=every,
54
+ show_label=show_label,
55
+ visible=visible,
56
+ elem_id=elem_id,
57
+ elem_classes=elem_classes,
58
+ render=render,
59
+ value=value,
60
+ )
61
+
62
+ def example_inputs(self) -> Any:
63
+ return "<p>Hello</p>"
64
+
65
+ def preprocess(self, payload: str | None) -> str | None:
66
+ return payload
67
+
68
+ def postprocess(self, value: str | None) -> str | None:
69
+ return value
70
+
71
+ def api_info(self) -> dict[str, Any]:
72
+ return {"type": "string"}
components/iframe/demo/__init__.py ADDED
File without changes
components/iframe/demo/app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_iframe import iFrame
4
+
5
+
6
+ example = iFrame().example_inputs()
7
+
8
+ with gr.Blocks() as demo:
9
+ with gr.Row():
10
+ iFrame(label="Blank"), # blank component
11
+ iFrame(value=example, label="Populated"), # populated component
12
+
13
+
14
+ demo.launch()
components/iframe/frontend/Example.svelte ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: string;
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+ </script>
6
+
7
+ <div
8
+ class:table={type === "table"}
9
+ class:gallery={type === "gallery"}
10
+ class:selected
11
+ class="prose"
12
+ >
13
+ {@html value}
14
+ </div>
15
+
16
+ <style>
17
+ .gallery {
18
+ padding: var(--size-2);
19
+ }
20
+ </style>
components/iframe/frontend/Index.svelte ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import type { Gradio } from "@gradio/utils";
3
+ import HTML from "./shared/HTML.svelte";
4
+ import { StatusTracker } from "@gradio/statustracker";
5
+ import type { LoadingStatus } from "@gradio/statustracker";
6
+ import { Block } from "@gradio/atoms";
7
+
8
+ export let label: string;
9
+ export let elem_id = "";
10
+ export let elem_classes: string[] = [];
11
+ export let visible = true;
12
+ export let value = "";
13
+ export let loading_status: LoadingStatus;
14
+ export let gradio: Gradio<{
15
+ change: never;
16
+ }>;
17
+
18
+ $: label, gradio.dispatch("change");
19
+ </script>
20
+
21
+ <Block {visible} {elem_id} {elem_classes} container={false}>
22
+ <StatusTracker
23
+ autoscroll={gradio.autoscroll}
24
+ i18n={gradio.i18n}
25
+ {...loading_status}
26
+ variant="center"
27
+ />
28
+ <div class:pending={loading_status?.status === "pending"}>
29
+ <HTML
30
+ min_height={loading_status && loading_status?.status !== "complete"}
31
+ {value}
32
+ {elem_classes}
33
+ {visible}
34
+ on:change={() => gradio.dispatch("change")}
35
+ />
36
+ </div>
37
+ </Block>
38
+
39
+ <style>
40
+ div {
41
+ transition: 150ms;
42
+ }
43
+
44
+ .pending {
45
+ opacity: 0.2;
46
+ }
47
+ </style>
components/iframe/frontend/package-lock.json ADDED
@@ -0,0 +1,917 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_iframe",
3
+ "version": "0.1.3",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "gradio_iframe",
9
+ "version": "0.1.3",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@gradio/atoms": "0.3.0",
13
+ "@gradio/statustracker": "0.4.0",
14
+ "@gradio/utils": "0.2.0"
15
+ }
16
+ },
17
+ "node_modules/@ampproject/remapping": {
18
+ "version": "2.2.1",
19
+ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
20
+ "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==",
21
+ "peer": true,
22
+ "dependencies": {
23
+ "@jridgewell/gen-mapping": "^0.3.0",
24
+ "@jridgewell/trace-mapping": "^0.3.9"
25
+ },
26
+ "engines": {
27
+ "node": ">=6.0.0"
28
+ }
29
+ },
30
+ "node_modules/@esbuild/android-arm": {
31
+ "version": "0.19.9",
32
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.9.tgz",
33
+ "integrity": "sha512-jkYjjq7SdsWuNI6b5quymW0oC83NN5FdRPuCbs9HZ02mfVdAP8B8eeqLSYU3gb6OJEaY5CQabtTFbqBf26H3GA==",
34
+ "cpu": [
35
+ "arm"
36
+ ],
37
+ "optional": true,
38
+ "os": [
39
+ "android"
40
+ ],
41
+ "engines": {
42
+ "node": ">=12"
43
+ }
44
+ },
45
+ "node_modules/@esbuild/android-arm64": {
46
+ "version": "0.19.9",
47
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.9.tgz",
48
+ "integrity": "sha512-q4cR+6ZD0938R19MyEW3jEsMzbb/1rulLXiNAJQADD/XYp7pT+rOS5JGxvpRW8dFDEfjW4wLgC/3FXIw4zYglQ==",
49
+ "cpu": [
50
+ "arm64"
51
+ ],
52
+ "optional": true,
53
+ "os": [
54
+ "android"
55
+ ],
56
+ "engines": {
57
+ "node": ">=12"
58
+ }
59
+ },
60
+ "node_modules/@esbuild/android-x64": {
61
+ "version": "0.19.9",
62
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.9.tgz",
63
+ "integrity": "sha512-KOqoPntWAH6ZxDwx1D6mRntIgZh9KodzgNOy5Ebt9ghzffOk9X2c1sPwtM9P+0eXbefnDhqYfkh5PLP5ULtWFA==",
64
+ "cpu": [
65
+ "x64"
66
+ ],
67
+ "optional": true,
68
+ "os": [
69
+ "android"
70
+ ],
71
+ "engines": {
72
+ "node": ">=12"
73
+ }
74
+ },
75
+ "node_modules/@esbuild/darwin-arm64": {
76
+ "version": "0.19.9",
77
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.9.tgz",
78
+ "integrity": "sha512-KBJ9S0AFyLVx2E5D8W0vExqRW01WqRtczUZ8NRu+Pi+87opZn5tL4Y0xT0mA4FtHctd0ZgwNoN639fUUGlNIWw==",
79
+ "cpu": [
80
+ "arm64"
81
+ ],
82
+ "optional": true,
83
+ "os": [
84
+ "darwin"
85
+ ],
86
+ "engines": {
87
+ "node": ">=12"
88
+ }
89
+ },
90
+ "node_modules/@esbuild/darwin-x64": {
91
+ "version": "0.19.9",
92
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.9.tgz",
93
+ "integrity": "sha512-vE0VotmNTQaTdX0Q9dOHmMTao6ObjyPm58CHZr1UK7qpNleQyxlFlNCaHsHx6Uqv86VgPmR4o2wdNq3dP1qyDQ==",
94
+ "cpu": [
95
+ "x64"
96
+ ],
97
+ "optional": true,
98
+ "os": [
99
+ "darwin"
100
+ ],
101
+ "engines": {
102
+ "node": ">=12"
103
+ }
104
+ },
105
+ "node_modules/@esbuild/freebsd-arm64": {
106
+ "version": "0.19.9",
107
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.9.tgz",
108
+ "integrity": "sha512-uFQyd/o1IjiEk3rUHSwUKkqZwqdvuD8GevWF065eqgYfexcVkxh+IJgwTaGZVu59XczZGcN/YMh9uF1fWD8j1g==",
109
+ "cpu": [
110
+ "arm64"
111
+ ],
112
+ "optional": true,
113
+ "os": [
114
+ "freebsd"
115
+ ],
116
+ "engines": {
117
+ "node": ">=12"
118
+ }
119
+ },
120
+ "node_modules/@esbuild/freebsd-x64": {
121
+ "version": "0.19.9",
122
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.9.tgz",
123
+ "integrity": "sha512-WMLgWAtkdTbTu1AWacY7uoj/YtHthgqrqhf1OaEWnZb7PQgpt8eaA/F3LkV0E6K/Lc0cUr/uaVP/49iE4M4asA==",
124
+ "cpu": [
125
+ "x64"
126
+ ],
127
+ "optional": true,
128
+ "os": [
129
+ "freebsd"
130
+ ],
131
+ "engines": {
132
+ "node": ">=12"
133
+ }
134
+ },
135
+ "node_modules/@esbuild/linux-arm": {
136
+ "version": "0.19.9",
137
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.9.tgz",
138
+ "integrity": "sha512-C/ChPohUYoyUaqn1h17m/6yt6OB14hbXvT8EgM1ZWaiiTYz7nWZR0SYmMnB5BzQA4GXl3BgBO1l8MYqL/He3qw==",
139
+ "cpu": [
140
+ "arm"
141
+ ],
142
+ "optional": true,
143
+ "os": [
144
+ "linux"
145
+ ],
146
+ "engines": {
147
+ "node": ">=12"
148
+ }
149
+ },
150
+ "node_modules/@esbuild/linux-arm64": {
151
+ "version": "0.19.9",
152
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.9.tgz",
153
+ "integrity": "sha512-PiPblfe1BjK7WDAKR1Cr9O7VVPqVNpwFcPWgfn4xu0eMemzRp442hXyzF/fSwgrufI66FpHOEJk0yYdPInsmyQ==",
154
+ "cpu": [
155
+ "arm64"
156
+ ],
157
+ "optional": true,
158
+ "os": [
159
+ "linux"
160
+ ],
161
+ "engines": {
162
+ "node": ">=12"
163
+ }
164
+ },
165
+ "node_modules/@esbuild/linux-ia32": {
166
+ "version": "0.19.9",
167
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.9.tgz",
168
+ "integrity": "sha512-f37i/0zE0MjDxijkPSQw1CO/7C27Eojqb+r3BbHVxMLkj8GCa78TrBZzvPyA/FNLUMzP3eyHCVkAopkKVja+6Q==",
169
+ "cpu": [
170
+ "ia32"
171
+ ],
172
+ "optional": true,
173
+ "os": [
174
+ "linux"
175
+ ],
176
+ "engines": {
177
+ "node": ">=12"
178
+ }
179
+ },
180
+ "node_modules/@esbuild/linux-loong64": {
181
+ "version": "0.19.9",
182
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.9.tgz",
183
+ "integrity": "sha512-t6mN147pUIf3t6wUt3FeumoOTPfmv9Cc6DQlsVBpB7eCpLOqQDyWBP1ymXn1lDw4fNUSb/gBcKAmvTP49oIkaA==",
184
+ "cpu": [
185
+ "loong64"
186
+ ],
187
+ "optional": true,
188
+ "os": [
189
+ "linux"
190
+ ],
191
+ "engines": {
192
+ "node": ">=12"
193
+ }
194
+ },
195
+ "node_modules/@esbuild/linux-mips64el": {
196
+ "version": "0.19.9",
197
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.9.tgz",
198
+ "integrity": "sha512-jg9fujJTNTQBuDXdmAg1eeJUL4Jds7BklOTkkH80ZgQIoCTdQrDaHYgbFZyeTq8zbY+axgptncko3v9p5hLZtw==",
199
+ "cpu": [
200
+ "mips64el"
201
+ ],
202
+ "optional": true,
203
+ "os": [
204
+ "linux"
205
+ ],
206
+ "engines": {
207
+ "node": ">=12"
208
+ }
209
+ },
210
+ "node_modules/@esbuild/linux-ppc64": {
211
+ "version": "0.19.9",
212
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.9.tgz",
213
+ "integrity": "sha512-tkV0xUX0pUUgY4ha7z5BbDS85uI7ABw3V1d0RNTii7E9lbmV8Z37Pup2tsLV46SQWzjOeyDi1Q7Wx2+QM8WaCQ==",
214
+ "cpu": [
215
+ "ppc64"
216
+ ],
217
+ "optional": true,
218
+ "os": [
219
+ "linux"
220
+ ],
221
+ "engines": {
222
+ "node": ">=12"
223
+ }
224
+ },
225
+ "node_modules/@esbuild/linux-riscv64": {
226
+ "version": "0.19.9",
227
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.9.tgz",
228
+ "integrity": "sha512-DfLp8dj91cufgPZDXr9p3FoR++m3ZJ6uIXsXrIvJdOjXVREtXuQCjfMfvmc3LScAVmLjcfloyVtpn43D56JFHg==",
229
+ "cpu": [
230
+ "riscv64"
231
+ ],
232
+ "optional": true,
233
+ "os": [
234
+ "linux"
235
+ ],
236
+ "engines": {
237
+ "node": ">=12"
238
+ }
239
+ },
240
+ "node_modules/@esbuild/linux-s390x": {
241
+ "version": "0.19.9",
242
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.9.tgz",
243
+ "integrity": "sha512-zHbglfEdC88KMgCWpOl/zc6dDYJvWGLiUtmPRsr1OgCViu3z5GncvNVdf+6/56O2Ca8jUU+t1BW261V6kp8qdw==",
244
+ "cpu": [
245
+ "s390x"
246
+ ],
247
+ "optional": true,
248
+ "os": [
249
+ "linux"
250
+ ],
251
+ "engines": {
252
+ "node": ">=12"
253
+ }
254
+ },
255
+ "node_modules/@esbuild/linux-x64": {
256
+ "version": "0.19.9",
257
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.9.tgz",
258
+ "integrity": "sha512-JUjpystGFFmNrEHQnIVG8hKwvA2DN5o7RqiO1CVX8EN/F/gkCjkUMgVn6hzScpwnJtl2mPR6I9XV1oW8k9O+0A==",
259
+ "cpu": [
260
+ "x64"
261
+ ],
262
+ "optional": true,
263
+ "os": [
264
+ "linux"
265
+ ],
266
+ "engines": {
267
+ "node": ">=12"
268
+ }
269
+ },
270
+ "node_modules/@esbuild/netbsd-x64": {
271
+ "version": "0.19.9",
272
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.9.tgz",
273
+ "integrity": "sha512-GThgZPAwOBOsheA2RUlW5UeroRfESwMq/guy8uEe3wJlAOjpOXuSevLRd70NZ37ZrpO6RHGHgEHvPg1h3S1Jug==",
274
+ "cpu": [
275
+ "x64"
276
+ ],
277
+ "optional": true,
278
+ "os": [
279
+ "netbsd"
280
+ ],
281
+ "engines": {
282
+ "node": ">=12"
283
+ }
284
+ },
285
+ "node_modules/@esbuild/openbsd-x64": {
286
+ "version": "0.19.9",
287
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.9.tgz",
288
+ "integrity": "sha512-Ki6PlzppaFVbLnD8PtlVQfsYw4S9n3eQl87cqgeIw+O3sRr9IghpfSKY62mggdt1yCSZ8QWvTZ9jo9fjDSg9uw==",
289
+ "cpu": [
290
+ "x64"
291
+ ],
292
+ "optional": true,
293
+ "os": [
294
+ "openbsd"
295
+ ],
296
+ "engines": {
297
+ "node": ">=12"
298
+ }
299
+ },
300
+ "node_modules/@esbuild/sunos-x64": {
301
+ "version": "0.19.9",
302
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.9.tgz",
303
+ "integrity": "sha512-MLHj7k9hWh4y1ddkBpvRj2b9NCBhfgBt3VpWbHQnXRedVun/hC7sIyTGDGTfsGuXo4ebik2+3ShjcPbhtFwWDw==",
304
+ "cpu": [
305
+ "x64"
306
+ ],
307
+ "optional": true,
308
+ "os": [
309
+ "sunos"
310
+ ],
311
+ "engines": {
312
+ "node": ">=12"
313
+ }
314
+ },
315
+ "node_modules/@esbuild/win32-arm64": {
316
+ "version": "0.19.9",
317
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.9.tgz",
318
+ "integrity": "sha512-GQoa6OrQ8G08guMFgeXPH7yE/8Dt0IfOGWJSfSH4uafwdC7rWwrfE6P9N8AtPGIjUzdo2+7bN8Xo3qC578olhg==",
319
+ "cpu": [
320
+ "arm64"
321
+ ],
322
+ "optional": true,
323
+ "os": [
324
+ "win32"
325
+ ],
326
+ "engines": {
327
+ "node": ">=12"
328
+ }
329
+ },
330
+ "node_modules/@esbuild/win32-ia32": {
331
+ "version": "0.19.9",
332
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.9.tgz",
333
+ "integrity": "sha512-UOozV7Ntykvr5tSOlGCrqU3NBr3d8JqPes0QWN2WOXfvkWVGRajC+Ym0/Wj88fUgecUCLDdJPDF0Nna2UK3Qtg==",
334
+ "cpu": [
335
+ "ia32"
336
+ ],
337
+ "optional": true,
338
+ "os": [
339
+ "win32"
340
+ ],
341
+ "engines": {
342
+ "node": ">=12"
343
+ }
344
+ },
345
+ "node_modules/@esbuild/win32-x64": {
346
+ "version": "0.19.9",
347
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.9.tgz",
348
+ "integrity": "sha512-oxoQgglOP7RH6iasDrhY+R/3cHrfwIDvRlT4CGChflq6twk8iENeVvMJjmvBb94Ik1Z+93iGO27err7w6l54GQ==",
349
+ "cpu": [
350
+ "x64"
351
+ ],
352
+ "optional": true,
353
+ "os": [
354
+ "win32"
355
+ ],
356
+ "engines": {
357
+ "node": ">=12"
358
+ }
359
+ },
360
+ "node_modules/@formatjs/ecma402-abstract": {
361
+ "version": "1.11.4",
362
+ "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz",
363
+ "integrity": "sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==",
364
+ "dependencies": {
365
+ "@formatjs/intl-localematcher": "0.2.25",
366
+ "tslib": "^2.1.0"
367
+ }
368
+ },
369
+ "node_modules/@formatjs/fast-memoize": {
370
+ "version": "1.2.1",
371
+ "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz",
372
+ "integrity": "sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==",
373
+ "dependencies": {
374
+ "tslib": "^2.1.0"
375
+ }
376
+ },
377
+ "node_modules/@formatjs/icu-messageformat-parser": {
378
+ "version": "2.1.0",
379
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz",
380
+ "integrity": "sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw==",
381
+ "dependencies": {
382
+ "@formatjs/ecma402-abstract": "1.11.4",
383
+ "@formatjs/icu-skeleton-parser": "1.3.6",
384
+ "tslib": "^2.1.0"
385
+ }
386
+ },
387
+ "node_modules/@formatjs/icu-skeleton-parser": {
388
+ "version": "1.3.6",
389
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz",
390
+ "integrity": "sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==",
391
+ "dependencies": {
392
+ "@formatjs/ecma402-abstract": "1.11.4",
393
+ "tslib": "^2.1.0"
394
+ }
395
+ },
396
+ "node_modules/@formatjs/intl-localematcher": {
397
+ "version": "0.2.25",
398
+ "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz",
399
+ "integrity": "sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==",
400
+ "dependencies": {
401
+ "tslib": "^2.1.0"
402
+ }
403
+ },
404
+ "node_modules/@gradio/atoms": {
405
+ "version": "0.3.0",
406
+ "resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.3.0.tgz",
407
+ "integrity": "sha512-7WQktAb+d8wEjTIYGzyQ8OdWsFSr0NA8adp8G/jAKoMZILJEoAAZSTnahCTSSQcbYIomVdfYA0ZmM342RCd8gg==",
408
+ "dependencies": {
409
+ "@gradio/icons": "^0.3.0",
410
+ "@gradio/utils": "^0.2.0"
411
+ }
412
+ },
413
+ "node_modules/@gradio/column": {
414
+ "version": "0.1.0",
415
+ "resolved": "https://registry.npmjs.org/@gradio/column/-/column-0.1.0.tgz",
416
+ "integrity": "sha512-P24nqqVnMXBaDA1f/zSN5HZRho4PxP8Dq+7VltPHlmxIEiZYik2AJ4J0LeuIha34FDO0guu/16evdrpvGIUAfw=="
417
+ },
418
+ "node_modules/@gradio/icons": {
419
+ "version": "0.3.1",
420
+ "resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.3.1.tgz",
421
+ "integrity": "sha512-ZwgXODKa7irD+spE0RCae8fyixgwKOtds6wHL300n9pIRYzL9QkvS1cQJbz0C6NupFCYRSGTQrV5hoLo7yQCew=="
422
+ },
423
+ "node_modules/@gradio/statustracker": {
424
+ "version": "0.4.0",
425
+ "resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.4.0.tgz",
426
+ "integrity": "sha512-Kgk4R2edFX4IK2UBit4UwmRfSrmvkYjKbiMfupj3qxHFwiDHT4YH4rAOqBlvdEWbCYMmLN6EyqqFaYb2+0GwXA==",
427
+ "dependencies": {
428
+ "@gradio/atoms": "^0.3.0",
429
+ "@gradio/column": "^0.1.0",
430
+ "@gradio/icons": "^0.3.0",
431
+ "@gradio/utils": "^0.2.0"
432
+ }
433
+ },
434
+ "node_modules/@gradio/theme": {
435
+ "version": "0.2.0",
436
+ "resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.2.0.tgz",
437
+ "integrity": "sha512-33c68Nk7oRXLn08OxPfjcPm7S4tXGOUV1I1bVgzdM2YV5o1QBOS1GEnXPZPu/CEYPePLMB6bsDwffrLEyLGWVQ=="
438
+ },
439
+ "node_modules/@gradio/utils": {
440
+ "version": "0.2.0",
441
+ "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.2.0.tgz",
442
+ "integrity": "sha512-YkwzXufi6IxQrlMW+1sFo8Yn6F9NLL69ZoBsbo7QEhms0v5L7pmOTw+dfd7M3dwbRP2lgjrb52i1kAIN3n6aqQ==",
443
+ "dependencies": {
444
+ "@gradio/theme": "^0.2.0",
445
+ "svelte-i18n": "^3.6.0"
446
+ }
447
+ },
448
+ "node_modules/@jridgewell/gen-mapping": {
449
+ "version": "0.3.3",
450
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
451
+ "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
452
+ "peer": true,
453
+ "dependencies": {
454
+ "@jridgewell/set-array": "^1.0.1",
455
+ "@jridgewell/sourcemap-codec": "^1.4.10",
456
+ "@jridgewell/trace-mapping": "^0.3.9"
457
+ },
458
+ "engines": {
459
+ "node": ">=6.0.0"
460
+ }
461
+ },
462
+ "node_modules/@jridgewell/resolve-uri": {
463
+ "version": "3.1.1",
464
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
465
+ "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
466
+ "peer": true,
467
+ "engines": {
468
+ "node": ">=6.0.0"
469
+ }
470
+ },
471
+ "node_modules/@jridgewell/set-array": {
472
+ "version": "1.1.2",
473
+ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
474
+ "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
475
+ "peer": true,
476
+ "engines": {
477
+ "node": ">=6.0.0"
478
+ }
479
+ },
480
+ "node_modules/@jridgewell/sourcemap-codec": {
481
+ "version": "1.4.15",
482
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
483
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
484
+ "peer": true
485
+ },
486
+ "node_modules/@jridgewell/trace-mapping": {
487
+ "version": "0.3.20",
488
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
489
+ "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
490
+ "peer": true,
491
+ "dependencies": {
492
+ "@jridgewell/resolve-uri": "^3.1.0",
493
+ "@jridgewell/sourcemap-codec": "^1.4.14"
494
+ }
495
+ },
496
+ "node_modules/@types/estree": {
497
+ "version": "1.0.5",
498
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
499
+ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
500
+ "peer": true
501
+ },
502
+ "node_modules/acorn": {
503
+ "version": "8.11.2",
504
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
505
+ "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
506
+ "peer": true,
507
+ "bin": {
508
+ "acorn": "bin/acorn"
509
+ },
510
+ "engines": {
511
+ "node": ">=0.4.0"
512
+ }
513
+ },
514
+ "node_modules/aria-query": {
515
+ "version": "5.3.0",
516
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
517
+ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
518
+ "peer": true,
519
+ "dependencies": {
520
+ "dequal": "^2.0.3"
521
+ }
522
+ },
523
+ "node_modules/axobject-query": {
524
+ "version": "3.2.1",
525
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
526
+ "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==",
527
+ "peer": true,
528
+ "dependencies": {
529
+ "dequal": "^2.0.3"
530
+ }
531
+ },
532
+ "node_modules/cli-color": {
533
+ "version": "2.0.3",
534
+ "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz",
535
+ "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==",
536
+ "dependencies": {
537
+ "d": "^1.0.1",
538
+ "es5-ext": "^0.10.61",
539
+ "es6-iterator": "^2.0.3",
540
+ "memoizee": "^0.4.15",
541
+ "timers-ext": "^0.1.7"
542
+ },
543
+ "engines": {
544
+ "node": ">=0.10"
545
+ }
546
+ },
547
+ "node_modules/code-red": {
548
+ "version": "1.0.4",
549
+ "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
550
+ "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==",
551
+ "peer": true,
552
+ "dependencies": {
553
+ "@jridgewell/sourcemap-codec": "^1.4.15",
554
+ "@types/estree": "^1.0.1",
555
+ "acorn": "^8.10.0",
556
+ "estree-walker": "^3.0.3",
557
+ "periscopic": "^3.1.0"
558
+ }
559
+ },
560
+ "node_modules/css-tree": {
561
+ "version": "2.3.1",
562
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
563
+ "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
564
+ "peer": true,
565
+ "dependencies": {
566
+ "mdn-data": "2.0.30",
567
+ "source-map-js": "^1.0.1"
568
+ },
569
+ "engines": {
570
+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
571
+ }
572
+ },
573
+ "node_modules/d": {
574
+ "version": "1.0.1",
575
+ "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
576
+ "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
577
+ "dependencies": {
578
+ "es5-ext": "^0.10.50",
579
+ "type": "^1.0.1"
580
+ }
581
+ },
582
+ "node_modules/deepmerge": {
583
+ "version": "4.3.1",
584
+ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
585
+ "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
586
+ "engines": {
587
+ "node": ">=0.10.0"
588
+ }
589
+ },
590
+ "node_modules/dequal": {
591
+ "version": "2.0.3",
592
+ "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
593
+ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
594
+ "peer": true,
595
+ "engines": {
596
+ "node": ">=6"
597
+ }
598
+ },
599
+ "node_modules/es5-ext": {
600
+ "version": "0.10.62",
601
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz",
602
+ "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==",
603
+ "hasInstallScript": true,
604
+ "dependencies": {
605
+ "es6-iterator": "^2.0.3",
606
+ "es6-symbol": "^3.1.3",
607
+ "next-tick": "^1.1.0"
608
+ },
609
+ "engines": {
610
+ "node": ">=0.10"
611
+ }
612
+ },
613
+ "node_modules/es6-iterator": {
614
+ "version": "2.0.3",
615
+ "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
616
+ "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
617
+ "dependencies": {
618
+ "d": "1",
619
+ "es5-ext": "^0.10.35",
620
+ "es6-symbol": "^3.1.1"
621
+ }
622
+ },
623
+ "node_modules/es6-symbol": {
624
+ "version": "3.1.3",
625
+ "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
626
+ "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
627
+ "dependencies": {
628
+ "d": "^1.0.1",
629
+ "ext": "^1.1.2"
630
+ }
631
+ },
632
+ "node_modules/es6-weak-map": {
633
+ "version": "2.0.3",
634
+ "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
635
+ "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
636
+ "dependencies": {
637
+ "d": "1",
638
+ "es5-ext": "^0.10.46",
639
+ "es6-iterator": "^2.0.3",
640
+ "es6-symbol": "^3.1.1"
641
+ }
642
+ },
643
+ "node_modules/esbuild": {
644
+ "version": "0.19.9",
645
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.9.tgz",
646
+ "integrity": "sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==",
647
+ "hasInstallScript": true,
648
+ "bin": {
649
+ "esbuild": "bin/esbuild"
650
+ },
651
+ "engines": {
652
+ "node": ">=12"
653
+ },
654
+ "optionalDependencies": {
655
+ "@esbuild/android-arm": "0.19.9",
656
+ "@esbuild/android-arm64": "0.19.9",
657
+ "@esbuild/android-x64": "0.19.9",
658
+ "@esbuild/darwin-arm64": "0.19.9",
659
+ "@esbuild/darwin-x64": "0.19.9",
660
+ "@esbuild/freebsd-arm64": "0.19.9",
661
+ "@esbuild/freebsd-x64": "0.19.9",
662
+ "@esbuild/linux-arm": "0.19.9",
663
+ "@esbuild/linux-arm64": "0.19.9",
664
+ "@esbuild/linux-ia32": "0.19.9",
665
+ "@esbuild/linux-loong64": "0.19.9",
666
+ "@esbuild/linux-mips64el": "0.19.9",
667
+ "@esbuild/linux-ppc64": "0.19.9",
668
+ "@esbuild/linux-riscv64": "0.19.9",
669
+ "@esbuild/linux-s390x": "0.19.9",
670
+ "@esbuild/linux-x64": "0.19.9",
671
+ "@esbuild/netbsd-x64": "0.19.9",
672
+ "@esbuild/openbsd-x64": "0.19.9",
673
+ "@esbuild/sunos-x64": "0.19.9",
674
+ "@esbuild/win32-arm64": "0.19.9",
675
+ "@esbuild/win32-ia32": "0.19.9",
676
+ "@esbuild/win32-x64": "0.19.9"
677
+ }
678
+ },
679
+ "node_modules/estree-walker": {
680
+ "version": "3.0.3",
681
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
682
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
683
+ "peer": true,
684
+ "dependencies": {
685
+ "@types/estree": "^1.0.0"
686
+ }
687
+ },
688
+ "node_modules/event-emitter": {
689
+ "version": "0.3.5",
690
+ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
691
+ "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
692
+ "dependencies": {
693
+ "d": "1",
694
+ "es5-ext": "~0.10.14"
695
+ }
696
+ },
697
+ "node_modules/ext": {
698
+ "version": "1.7.0",
699
+ "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
700
+ "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==",
701
+ "dependencies": {
702
+ "type": "^2.7.2"
703
+ }
704
+ },
705
+ "node_modules/ext/node_modules/type": {
706
+ "version": "2.7.2",
707
+ "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
708
+ "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
709
+ },
710
+ "node_modules/globalyzer": {
711
+ "version": "0.1.0",
712
+ "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
713
+ "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q=="
714
+ },
715
+ "node_modules/globrex": {
716
+ "version": "0.1.2",
717
+ "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
718
+ "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
719
+ },
720
+ "node_modules/intl-messageformat": {
721
+ "version": "9.13.0",
722
+ "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz",
723
+ "integrity": "sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw==",
724
+ "dependencies": {
725
+ "@formatjs/ecma402-abstract": "1.11.4",
726
+ "@formatjs/fast-memoize": "1.2.1",
727
+ "@formatjs/icu-messageformat-parser": "2.1.0",
728
+ "tslib": "^2.1.0"
729
+ }
730
+ },
731
+ "node_modules/is-promise": {
732
+ "version": "2.2.2",
733
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
734
+ "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
735
+ },
736
+ "node_modules/is-reference": {
737
+ "version": "3.0.2",
738
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz",
739
+ "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==",
740
+ "peer": true,
741
+ "dependencies": {
742
+ "@types/estree": "*"
743
+ }
744
+ },
745
+ "node_modules/locate-character": {
746
+ "version": "3.0.0",
747
+ "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
748
+ "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
749
+ "peer": true
750
+ },
751
+ "node_modules/lru-queue": {
752
+ "version": "0.1.0",
753
+ "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz",
754
+ "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==",
755
+ "dependencies": {
756
+ "es5-ext": "~0.10.2"
757
+ }
758
+ },
759
+ "node_modules/magic-string": {
760
+ "version": "0.30.5",
761
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
762
+ "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
763
+ "peer": true,
764
+ "dependencies": {
765
+ "@jridgewell/sourcemap-codec": "^1.4.15"
766
+ },
767
+ "engines": {
768
+ "node": ">=12"
769
+ }
770
+ },
771
+ "node_modules/mdn-data": {
772
+ "version": "2.0.30",
773
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
774
+ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",
775
+ "peer": true
776
+ },
777
+ "node_modules/memoizee": {
778
+ "version": "0.4.15",
779
+ "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz",
780
+ "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==",
781
+ "dependencies": {
782
+ "d": "^1.0.1",
783
+ "es5-ext": "^0.10.53",
784
+ "es6-weak-map": "^2.0.3",
785
+ "event-emitter": "^0.3.5",
786
+ "is-promise": "^2.2.2",
787
+ "lru-queue": "^0.1.0",
788
+ "next-tick": "^1.1.0",
789
+ "timers-ext": "^0.1.7"
790
+ }
791
+ },
792
+ "node_modules/mri": {
793
+ "version": "1.2.0",
794
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
795
+ "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
796
+ "engines": {
797
+ "node": ">=4"
798
+ }
799
+ },
800
+ "node_modules/next-tick": {
801
+ "version": "1.1.0",
802
+ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
803
+ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
804
+ },
805
+ "node_modules/periscopic": {
806
+ "version": "3.1.0",
807
+ "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz",
808
+ "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==",
809
+ "peer": true,
810
+ "dependencies": {
811
+ "@types/estree": "^1.0.0",
812
+ "estree-walker": "^3.0.0",
813
+ "is-reference": "^3.0.0"
814
+ }
815
+ },
816
+ "node_modules/sade": {
817
+ "version": "1.8.1",
818
+ "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
819
+ "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==",
820
+ "dependencies": {
821
+ "mri": "^1.1.0"
822
+ },
823
+ "engines": {
824
+ "node": ">=6"
825
+ }
826
+ },
827
+ "node_modules/source-map-js": {
828
+ "version": "1.0.2",
829
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
830
+ "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
831
+ "peer": true,
832
+ "engines": {
833
+ "node": ">=0.10.0"
834
+ }
835
+ },
836
+ "node_modules/svelte": {
837
+ "version": "4.2.8",
838
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.8.tgz",
839
+ "integrity": "sha512-hU6dh1MPl8gh6klQZwK/n73GiAHiR95IkFsesLPbMeEZi36ydaXL/ZAb4g9sayT0MXzpxyZjR28yderJHxcmYA==",
840
+ "peer": true,
841
+ "dependencies": {
842
+ "@ampproject/remapping": "^2.2.1",
843
+ "@jridgewell/sourcemap-codec": "^1.4.15",
844
+ "@jridgewell/trace-mapping": "^0.3.18",
845
+ "acorn": "^8.9.0",
846
+ "aria-query": "^5.3.0",
847
+ "axobject-query": "^3.2.1",
848
+ "code-red": "^1.0.3",
849
+ "css-tree": "^2.3.1",
850
+ "estree-walker": "^3.0.3",
851
+ "is-reference": "^3.0.1",
852
+ "locate-character": "^3.0.0",
853
+ "magic-string": "^0.30.4",
854
+ "periscopic": "^3.1.0"
855
+ },
856
+ "engines": {
857
+ "node": ">=16"
858
+ }
859
+ },
860
+ "node_modules/svelte-i18n": {
861
+ "version": "3.7.4",
862
+ "resolved": "https://registry.npmjs.org/svelte-i18n/-/svelte-i18n-3.7.4.tgz",
863
+ "integrity": "sha512-yGRCNo+eBT4cPuU7IVsYTYjxB7I2V8qgUZPlHnNctJj5IgbJgV78flsRzpjZ/8iUYZrS49oCt7uxlU3AZv/N5Q==",
864
+ "dependencies": {
865
+ "cli-color": "^2.0.3",
866
+ "deepmerge": "^4.2.2",
867
+ "esbuild": "^0.19.2",
868
+ "estree-walker": "^2",
869
+ "intl-messageformat": "^9.13.0",
870
+ "sade": "^1.8.1",
871
+ "tiny-glob": "^0.2.9"
872
+ },
873
+ "bin": {
874
+ "svelte-i18n": "dist/cli.js"
875
+ },
876
+ "engines": {
877
+ "node": ">= 16"
878
+ },
879
+ "peerDependencies": {
880
+ "svelte": "^3 || ^4"
881
+ }
882
+ },
883
+ "node_modules/svelte-i18n/node_modules/estree-walker": {
884
+ "version": "2.0.2",
885
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
886
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
887
+ },
888
+ "node_modules/timers-ext": {
889
+ "version": "0.1.7",
890
+ "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz",
891
+ "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==",
892
+ "dependencies": {
893
+ "es5-ext": "~0.10.46",
894
+ "next-tick": "1"
895
+ }
896
+ },
897
+ "node_modules/tiny-glob": {
898
+ "version": "0.2.9",
899
+ "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
900
+ "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
901
+ "dependencies": {
902
+ "globalyzer": "0.1.0",
903
+ "globrex": "^0.1.2"
904
+ }
905
+ },
906
+ "node_modules/tslib": {
907
+ "version": "2.6.2",
908
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
909
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
910
+ },
911
+ "node_modules/type": {
912
+ "version": "1.2.0",
913
+ "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
914
+ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
915
+ }
916
+ }
917
+ }
components/iframe/frontend/package.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_iframe",
3
+ "version": "0.1.3",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "dependencies": {
11
+ "@gradio/atoms": "0.3.0",
12
+ "@gradio/statustracker": "0.4.0",
13
+ "@gradio/utils": "0.2.0"
14
+ },
15
+ "exports": {
16
+ ".": "./Index.svelte",
17
+ "./example": "./Example.svelte",
18
+ "./package.json": "./package.json"
19
+ }
20
+ }
components/iframe/frontend/shared/HTML.svelte ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from "svelte";
3
+ export let elem_classes: string[] = [];
4
+ export let value: string;
5
+ export let visible = true;
6
+ export let min_height = false;
7
+
8
+ const dispatch = createEventDispatcher<{ change: undefined }>();
9
+
10
+ $: value, dispatch("change");
11
+ </script>
12
+
13
+ <div
14
+ class="prose {elem_classes.join(' ')}"
15
+ class:min={min_height}
16
+ class:hide={!visible}
17
+ >
18
+ {@html value}
19
+ </div>
20
+
21
+ <style>
22
+ .min {
23
+ min-height: var(--size-24);
24
+ }
25
+ .hide {
26
+ display: none;
27
+ }
28
+ </style>
components/iframe/pyproject.toml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "hatchling",
4
+ "hatch-requirements-txt",
5
+ "hatch-fancy-pypi-readme>=22.5.0",
6
+ ]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "gradio_iframe"
11
+ version = "0.0.1"
12
+ description = "A custom component allowing an iFrame component inside Gradio, based on the existing HTML component implementation."
13
+ readme = "README.md"
14
+ license = "MIT"
15
+ requires-python = ">=3.8"
16
+ authors = [{ name = "YOUR NAME", email = "YOUREMAIL@domain.com" }]
17
+ keywords = ["gradio-custom-component", "gradio-template-HTML", "iFrame", "HTML"]
18
+ # Add dependencies here
19
+ dependencies = ["gradio>=4.0,<5.0"]
20
+ classifiers = [
21
+ 'Development Status :: 3 - Alpha',
22
+ 'License :: OSI Approved :: Apache Software License',
23
+ 'Operating System :: OS Independent',
24
+ 'Programming Language :: Python :: 3',
25
+ 'Programming Language :: Python :: 3 :: Only',
26
+ 'Programming Language :: Python :: 3.8',
27
+ 'Programming Language :: Python :: 3.9',
28
+ 'Programming Language :: Python :: 3.10',
29
+ 'Programming Language :: Python :: 3.11',
30
+ 'Topic :: Scientific/Engineering',
31
+ 'Topic :: Scientific/Engineering :: Artificial Intelligence',
32
+ 'Topic :: Scientific/Engineering :: Visualization',
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ dev = ["build", "twine"]
37
+
38
+ [tool.hatch.build]
39
+ artifacts = ["/backend/gradio_iframe/templates", "*.pyi"]
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["/backend/gradio_iframe"]
explanation/interpret.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import seaborn as sns
2
+ import matplotlib.pyplot as plt
3
+
4
+ def interpret_plot(shap_values):
5
+ values=shap_values[0]
6
+ input_text = shap_values.data[0]
7
+ output_text = shap_values.output_names
8
+
9
+ # Set the seaborn style for better aesthetics
10
+ sns.set(style="whitegrid")
11
+ plt.figure(figsize=(20, 10))
12
+
13
+ # Create the heatmap with horizontal shape
14
+ sns.heatmap(shap_values_large, cmap=color_palette, center=0, annot=False, cbar_kws={'fraction': 0.02})
15
+
16
+ # Adjust the labels for the larger set
17
+ plt.xticks(ticks=np.arange(len(output_text_large)) + 0.5, labels=output_text_large, rotation=90)
18
+ plt.yticks(ticks=np.arange(len(input_text_large)) + 0.5, labels=input_text_large, rotation=0)
19
+
20
+ plt.xlabel("Output Tokens")
21
+ plt.ylabel("Input Tokens")
22
+
23
+ return plt
main.py CHANGED
@@ -1,37 +1,45 @@
1
  # main application file initializing the gradio based ui and calling other modules
2
 
 
 
 
 
 
 
 
 
3
  # external package imports
4
  import gradio as gr
5
  import markdown
6
  from fastapi import FastAPI
7
- import os
8
 
9
  # internal imports
10
- from model import mistral
11
- from controller import controller as contr
12
 
13
  # Global Variables
14
  app = FastAPI()
15
 
16
  # different functions to provide frontend abilities
17
- def load_md(path):
18
 
 
 
19
  # credit: official python-markdown documentation (https://python-markdown.github.io/reference/)
20
  with open(path, "r") as file:
21
  text = file.read()
22
-
23
- # return markdown as a string
24
  return markdown.markdown(text)
25
 
 
26
  def system_prompt_info(sys_prompt_txt):
27
  gr.Info(f"The system prompt was set to:\n {sys_prompt_txt}")
28
 
 
29
  def xai_info(xai_radio):
30
  if xai_radio != "None":
31
  gr.Info(f"The XAI was set to:\n {xai_radio}")
32
  else:
33
  gr.Info(f"No XAI method was selected.")
34
 
 
35
  def model_info(model_radio):
36
  gr.Info(f"The model was set to:\n {model_radio}")
37
 
@@ -82,8 +90,10 @@ with gr.Blocks() as ui:
82
  submit_btn = gr.Button("Submit", variant="primary")
83
 
84
  # two functions performing the same action (triggered the model response), when the button is used or the textbox submit function is used (clicking enter).
85
- submit_btn.click(contr.interference, [user_prompt, chatbot, system_prompt, model, xai], [user_prompt, chatbot])
86
- user_prompt.submit(contr.interference, [user_prompt, chatbot, system_prompt, model, xai], [user_prompt, chatbot])
 
 
87
 
88
  # explanations tab used to provide explanations for a specific conversation
89
  with gr.Tab("Explanations"):
@@ -93,15 +103,11 @@ with gr.Blocks() as ui:
93
  ### Get Explanations for Conversations
94
  Using your selected XAI method, you can get explanations for the conversation you had with the AI ChatBot. The explanations are based on the last message you sent to the AI ChatBot.
95
  """)
96
-
97
- # visualize dashboard to display global visualization provided by the BERTViz adoption
98
- with gr.Tab("Visualize Dashboard"):
99
  with gr.Row():
100
- gr.Markdown(
101
- """
102
- ### Visualization Dashboard
103
- Global Visualization Dashboard adopted from [BERTViz](https://github.com/jessevig/bertviz)
104
- """)
105
 
106
 
107
  # final row to show legal information - credits, data protection and link to the LICENSE on GitHub
 
1
  # main application file initializing the gradio based ui and calling other modules
2
 
3
+ import subprocess
4
+ import sys
5
+
6
+ def install(package):
7
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "./components/testinghtml/dist/gradio_testinghtml-0.0.1-py3-none-any.whl"])
8
+
9
+ from gradio_testinghtml import testingHTML
10
+
11
  # external package imports
12
  import gradio as gr
13
  import markdown
14
  from fastapi import FastAPI
 
15
 
16
  # internal imports
17
+ from backend.controller import interference
 
18
 
19
  # Global Variables
20
  app = FastAPI()
21
 
22
  # different functions to provide frontend abilities
 
23
 
24
+ # function to load markdown files
25
+ def load_md(path):
26
  # credit: official python-markdown documentation (https://python-markdown.github.io/reference/)
27
  with open(path, "r") as file:
28
  text = file.read()
 
 
29
  return markdown.markdown(text)
30
 
31
+ # function to display the system prompt info
32
  def system_prompt_info(sys_prompt_txt):
33
  gr.Info(f"The system prompt was set to:\n {sys_prompt_txt}")
34
 
35
+ # function to display the xai info
36
  def xai_info(xai_radio):
37
  if xai_radio != "None":
38
  gr.Info(f"The XAI was set to:\n {xai_radio}")
39
  else:
40
  gr.Info(f"No XAI method was selected.")
41
 
42
+ # function to display the model info
43
  def model_info(model_radio):
44
  gr.Info(f"The model was set to:\n {model_radio}")
45
 
 
90
  submit_btn = gr.Button("Submit", variant="primary")
91
 
92
  # two functions performing the same action (triggered the model response), when the button is used or the textbox submit function is used (clicking enter).
93
+ # hands over the information needed for the chat (prompt, history, and system prompt) and the information needed to call the right model and xai function (model, xai)
94
+ # returns the prompt and history to be displayed in the chatbot ui
95
+ submit_btn.click(interference, [user_prompt, chatbot, system_prompt, model, xai], [user_prompt, chatbot])
96
+ user_prompt.submit(interference, [user_prompt, chatbot, system_prompt, model, xai], [user_prompt, chatbot])
97
 
98
  # explanations tab used to provide explanations for a specific conversation
99
  with gr.Tab("Explanations"):
 
103
  ### Get Explanations for Conversations
104
  Using your selected XAI method, you can get explanations for the conversation you had with the AI ChatBot. The explanations are based on the last message you sent to the AI ChatBot.
105
  """)
 
 
 
106
  with gr.Row():
107
+ gr.HTML(load_md("public/explanations.md"))
108
+ with gr.Row():
109
+ with gr.Accordion("Full Size Plot of All SHAP Values", open=False):
110
+ gr.Plot(label="SHAP Values Plot")
 
111
 
112
 
113
  # final row to show legal information - credits, data protection and link to the LICENSE on GitHub
model/llama2.py CHANGED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ model_temperature = 0.7
2
+ model_max_new_tokens = 100
3
+ model_top_p = 0.95
4
+ model_repetition_penalty = 1.1
model/mistral.py CHANGED
@@ -10,19 +10,17 @@ interference = InferenceClient(
10
  "mistralai/Mistral-7B-Instruct-v0.1"
11
  )
12
 
 
 
 
 
 
13
  # chat function - basically the main function calling other functions and returning a response to showcase in chatbot ui
14
- def chat (prompt,
15
- history,
16
- temperature=0.7,
17
- max_new_tokens = 320,
18
- top_p = 0.95,
19
- repetition_penalty = 1.1,
20
- system_prompt = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe."
21
- ):
22
 
23
  # creating formatted prompt and calling for an answer from the model
24
  formatted_prompt = format_prompt(prompt, history)
25
- answer=respond(formatted_prompt,system_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
26
 
27
  # updating the chat history with the new answer
28
  history.append((prompt, answer))
@@ -44,7 +42,8 @@ def format_prompt(message, history):
44
 
45
  # function to get the response
46
  # credit: minimally changed from Hugging Face, Inc/ Omar Sanseviero (see https://huggingface.co/spaces/osanseviero/mistral-super-fast/)
47
- def respond(formatted_prompt, system_prompt, temperature, max_new_tokens, top_p, repetition_penalty):
 
48
 
49
  # setting model temperature and
50
  temperature = float(temperature)
 
10
  "mistralai/Mistral-7B-Instruct-v0.1"
11
  )
12
 
13
+ temperature = 0.7
14
+ max_new_tokens = 100
15
+ top_p = 0.95
16
+ repetition_penalty = 1.1
17
+
18
  # chat function - basically the main function calling other functions and returning a response to showcase in chatbot ui
19
+ def chat (prompt,history,system_prompt):
 
 
 
 
 
 
 
20
 
21
  # creating formatted prompt and calling for an answer from the model
22
  formatted_prompt = format_prompt(prompt, history)
23
+ answer=respond(formatted_prompt,system_prompt)
24
 
25
  # updating the chat history with the new answer
26
  history.append((prompt, answer))
 
42
 
43
  # function to get the response
44
  # credit: minimally changed from Hugging Face, Inc/ Omar Sanseviero (see https://huggingface.co/spaces/osanseviero/mistral-super-fast/)
45
+ def respond(formatted_prompt, system_prompt):
46
+ global temperature, max_new_tokens, top_p, repetition_penalty
47
 
48
  # setting model temperature and
49
  temperature = float(temperature)