Spaces:
Runtime error
Runtime error
feat: implementing latest version and basic interpretability methods
Browse files- .github/workflows/docker-publish.yml +9 -10
- .github/workflows/hgf-sync-main.yml +9 -0
- .github/workflows/python-app.yml +11 -3
- .idea/thesis-webapp.iml +7 -1
- .pre-commit-config.yaml +2 -1
- Dockerfile +10 -9
- Dockerfile-Base +2 -1
- __init__.py +2 -0
- backend/__init__.py +2 -0
- backend/controller.py +88 -33
- components/iframe/.gitignore +9 -0
- components/iframe/README.md +10 -0
- components/iframe/backend/gradio_iframe/__init__.py +3 -0
- components/iframe/backend/gradio_iframe/iframe.py +72 -0
- components/iframe/backend/gradio_iframe/templates/component/index.js +1994 -0
- components/iframe/backend/gradio_iframe/templates/component/style.css +1 -0
- components/iframe/backend/gradio_iframe/templates/example/index.js +80 -0
- components/iframe/backend/gradio_iframe/templates/example/style.css +1 -0
- components/iframe/demo/__init__.py +0 -0
- components/iframe/demo/app.py +13 -0
- components/iframe/frontend/Example.svelte +20 -0
- components/iframe/frontend/Index.svelte +47 -0
- components/iframe/frontend/package-lock.json +933 -0
- components/iframe/frontend/package.json +20 -0
- components/iframe/frontend/shared/HTML.svelte +28 -0
- components/iframe/pyproject.toml +42 -0
- entrypoint.sh +1 -0
- explanation/__init__.py +2 -0
- explanation/interpret.py +56 -11
- explanation/visualize.py +21 -0
- main.py +77 -31
- model/__init__.py +2 -0
- model/godel.py +38 -0
- model/llama2.py +0 -4
- model/mistral.py +66 -73
- pyproject.toml +4 -0
- requirements.txt +6 -1
.github/workflows/docker-publish.yml
CHANGED
@@ -1,10 +1,8 @@
|
|
|
|
|
|
1 |
name: Docker
|
2 |
|
3 |
-
#
|
4 |
-
# They are provided by a third-party and are governed by
|
5 |
-
# separate terms of service, privacy policy, and support
|
6 |
-
# documentation.
|
7 |
-
|
8 |
on:
|
9 |
schedule:
|
10 |
- cron: '22 7 * * *'
|
@@ -12,21 +10,23 @@ on:
|
|
12 |
types: created
|
13 |
|
14 |
env:
|
15 |
-
#
|
16 |
REGISTRY: ghcr.io
|
17 |
-
# github.repository as <account>/<repo>
|
18 |
IMAGE_NAME: ${{ github.repository }}:${{ github.ref }}
|
19 |
|
20 |
-
|
21 |
jobs:
|
22 |
-
build:
|
23 |
|
|
|
|
|
24 |
runs-on: ubuntu-latest
|
25 |
permissions:
|
26 |
contents: read
|
27 |
packages: write
|
28 |
id-token: write
|
29 |
|
|
|
30 |
steps:
|
31 |
- name: Checkout repository
|
32 |
uses: actions/checkout@v3
|
@@ -34,7 +34,6 @@ jobs:
|
|
34 |
# Install the cosign tool except on PR
|
35 |
# https://github.com/sigstore/cosign-installer
|
36 |
- name: Install cosign
|
37 |
-
if: github.event_name != 'pull_request'
|
38 |
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
|
39 |
with:
|
40 |
cosign-release: 'v2.1.1'
|
|
|
1 |
+
# Docker image build and publish workflow
|
2 |
+
# CREDIT: Adopted from
|
3 |
name: Docker
|
4 |
|
5 |
+
# running on every release and on manual dispatch
|
|
|
|
|
|
|
|
|
6 |
on:
|
7 |
schedule:
|
8 |
- cron: '22 7 * * *'
|
|
|
10 |
types: created
|
11 |
|
12 |
env:
|
13 |
+
# set the registry to the GitHub Container Registry
|
14 |
REGISTRY: ghcr.io
|
15 |
+
# set github.repository as <account>/<repo>
|
16 |
IMAGE_NAME: ${{ github.repository }}:${{ github.ref }}
|
17 |
|
18 |
+
# jobs to run
|
19 |
jobs:
|
|
|
20 |
|
21 |
+
# build job
|
22 |
+
build:
|
23 |
runs-on: ubuntu-latest
|
24 |
permissions:
|
25 |
contents: read
|
26 |
packages: write
|
27 |
id-token: write
|
28 |
|
29 |
+
# steps to run on the job
|
30 |
steps:
|
31 |
- name: Checkout repository
|
32 |
uses: actions/checkout@v3
|
|
|
34 |
# Install the cosign tool except on PR
|
35 |
# https://github.com/sigstore/cosign-installer
|
36 |
- name: Install cosign
|
|
|
37 |
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
|
38 |
with:
|
39 |
cosign-release: 'v2.1.1'
|
.github/workflows/hgf-sync-main.yml
CHANGED
@@ -1,19 +1,28 @@
|
|
|
|
|
|
|
|
1 |
name: HGF Hub Sync (Main)
|
|
|
2 |
on:
|
3 |
push:
|
4 |
branches: [main]
|
5 |
|
6 |
workflow_dispatch:
|
7 |
|
|
|
8 |
jobs:
|
|
|
9 |
sync-to-hub:
|
10 |
runs-on: ubuntu-latest
|
11 |
steps:
|
|
|
12 |
- uses: actions/checkout@v3
|
13 |
with:
|
14 |
fetch-depth: 0
|
15 |
lfs: true
|
|
|
16 |
- name: Push to hub
|
17 |
env:
|
18 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
|
19 |
run: git push https://LennardZuendorf:[email protected]/spaces/LennardZuendorf/thesis-webapp-docker main
|
|
|
1 |
+
# workflow that syncs the main branch to the Hugging Face Hub (Huggingface Spaces)
|
2 |
+
#CREDIT Copied from Hugging Face, Inc.
|
3 |
+
|
4 |
name: HGF Hub Sync (Main)
|
5 |
+
# runs on pushes to the main branch and manually triggered workflows
|
6 |
on:
|
7 |
push:
|
8 |
branches: [main]
|
9 |
|
10 |
workflow_dispatch:
|
11 |
|
12 |
+
# jobs to run
|
13 |
jobs:
|
14 |
+
# sync job
|
15 |
sync-to-hub:
|
16 |
runs-on: ubuntu-latest
|
17 |
steps:
|
18 |
+
# checkout the repository
|
19 |
- uses: actions/checkout@v3
|
20 |
with:
|
21 |
fetch-depth: 0
|
22 |
lfs: true
|
23 |
+
# push to hub with huggingface token
|
24 |
- name: Push to hub
|
25 |
env:
|
26 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
27 |
+
# run git push
|
28 |
run: git push https://LennardZuendorf:[email protected]/spaces/LennardZuendorf/thesis-webapp-docker main
|
.github/workflows/python-app.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
-
#
|
2 |
-
#
|
|
|
3 |
|
4 |
name: Python Install and Linting
|
5 |
|
|
|
6 |
on:
|
7 |
push:
|
8 |
|
@@ -13,23 +15,29 @@ on:
|
|
13 |
permissions:
|
14 |
contents: read
|
15 |
|
|
|
16 |
jobs:
|
|
|
17 |
build:
|
18 |
-
|
19 |
runs-on: ubuntu-latest
|
20 |
|
21 |
steps:
|
|
|
22 |
- uses: actions/checkout@v3
|
|
|
23 |
- name: Set up Python 3.10
|
24 |
uses: actions/setup-python@v3
|
25 |
with:
|
26 |
python-version: "3.10"
|
|
|
27 |
- name: Install dependencies
|
28 |
run: |
|
29 |
python -m pip install --upgrade pip
|
30 |
pip install pylint black
|
31 |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
32 |
- name: Lint & Fix with Black
|
33 |
run: black .
|
|
|
34 |
- name: Lint with Pylint
|
35 |
run: pylint .
|
|
|
1 |
+
# workflow file tp build a python app and lint it
|
2 |
+
# CREDIT: Adopted from Github Actions Documentation
|
3 |
+
## see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
4 |
|
5 |
name: Python Install and Linting
|
6 |
|
7 |
+
# runs on every push/pr to any repo and on manual dispatch
|
8 |
on:
|
9 |
push:
|
10 |
|
|
|
15 |
permissions:
|
16 |
contents: read
|
17 |
|
18 |
+
# jobs to run
|
19 |
jobs:
|
20 |
+
# main build job that installs dependencies and lints
|
21 |
build:
|
|
|
22 |
runs-on: ubuntu-latest
|
23 |
|
24 |
steps:
|
25 |
+
# checkout the repository
|
26 |
- uses: actions/checkout@v3
|
27 |
+
# set up python 3.10
|
28 |
- name: Set up Python 3.10
|
29 |
uses: actions/setup-python@v3
|
30 |
with:
|
31 |
python-version: "3.10"
|
32 |
+
# install dependencies from requirements.txt
|
33 |
- name: Install dependencies
|
34 |
run: |
|
35 |
python -m pip install --upgrade pip
|
36 |
pip install pylint black
|
37 |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
38 |
+
# lint and format all files with black (as defined in pyproject.toml)
|
39 |
- name: Lint & Fix with Black
|
40 |
run: black .
|
41 |
+
# lint with pylint
|
42 |
- name: Lint with Pylint
|
43 |
run: pylint .
|
.idea/thesis-webapp.iml
CHANGED
@@ -1,7 +1,13 @@
|
|
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/bertviz/backend" isTestSource="false" />
|
6 |
+
<sourceFolder url="file://$MODULE_DIR$/components/iframe/backend" isTestSource="false" />
|
7 |
+
<sourceFolder url="file://$MODULE_DIR$/components/shap-plots/backend" isTestSource="false" />
|
8 |
+
<sourceFolder url="file://$MODULE_DIR$/components/shap/backend" isTestSource="false" />
|
9 |
+
<sourceFolder url="file://$MODULE_DIR$/components/visualizer/backend" isTestSource="false" />
|
10 |
+
</content>
|
11 |
<orderEntry type="jdk" jdkName="Python 3.11.6 WSL (Ubuntu): (/home/lennard/.virtualenvs/thesis/bin/python)" jdkType="Python SDK" />
|
12 |
<orderEntry type="sourceFolder" forTests="false" />
|
13 |
</component>
|
.pre-commit-config.yaml
CHANGED
@@ -10,15 +10,16 @@ repos:
|
|
10 |
hooks:
|
11 |
- id: black
|
12 |
language_version: python3.11
|
|
|
13 |
- repo: local
|
14 |
hooks:
|
15 |
- id: pylint
|
16 |
name: pylint
|
17 |
entry: pylint
|
|
|
18 |
language: system
|
19 |
types: [python]
|
20 |
args:
|
21 |
[
|
22 |
"-rn", # Only display messages
|
23 |
-
"-sn", # Don't display the score
|
24 |
]
|
|
|
10 |
hooks:
|
11 |
- id: black
|
12 |
language_version: python3.11
|
13 |
+
exclude: ^components/
|
14 |
- repo: local
|
15 |
hooks:
|
16 |
- id: pylint
|
17 |
name: pylint
|
18 |
entry: pylint
|
19 |
+
exclude: ^components/
|
20 |
language: system
|
21 |
types: [python]
|
22 |
args:
|
23 |
[
|
24 |
"-rn", # Only display messages
|
|
|
25 |
]
|
Dockerfile
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
-
#
|
2 |
|
3 |
-
|
4 |
-
FROM python:3.11.6
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
# install dependencies and copy files
|
10 |
COPY requirements.txt .
|
11 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
RUN pip install fastapi uvicorn
|
13 |
COPY . .
|
14 |
|
|
|
15 |
RUN ls --recursive .
|
16 |
|
17 |
# setting config and run command
|
18 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
19 |
|
20 |
-
# build and run commands
|
21 |
-
## docker build -t thesis:0.
|
22 |
-
## docker run -d --name thesis -p 8080:8080 thesis:0.
|
|
|
1 |
+
# standard Dockerfile to build a complete, working image of the webapp
|
2 |
|
3 |
+
# complete build based on clean python (slower)
|
4 |
+
#FROM python:3.11.6
|
5 |
|
6 |
+
# build based on python with dependencies (quicker) - for dev
|
7 |
+
FROM thesis:0.2.0-base
|
8 |
|
9 |
+
# install dependencies and copy files into image folder
|
10 |
COPY requirements.txt .
|
11 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
RUN pip install fastapi uvicorn
|
13 |
COPY . .
|
14 |
|
15 |
+
# display files in image folder (for debugging)
|
16 |
RUN ls --recursive .
|
17 |
|
18 |
# setting config and run command
|
19 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
20 |
|
21 |
+
# build and run commands:
|
22 |
+
## docker build -t thesis:0.2.0-full -f Dockerfile .
|
23 |
+
## docker run -d --name thesis -p 8080:8080 thesis:0.2.0
|
Dockerfile-Base
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
# Dockerfile to create base image with all needed dependencies
|
|
|
2 |
|
3 |
# using newest python as a base image
|
4 |
FROM python:3.11.6
|
|
|
1 |
+
# Dockerfile to create base image with all needed dependencies. for the quick dockerfile build of the webapp
|
2 |
+
# because all dependencies are already installed, the next webapp build using this base image is much quicker
|
3 |
|
4 |
# using newest python as a base image
|
5 |
FROM python:3.11.6
|
__init__.py
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# empty init file for the package
|
2 |
+
# for fastapi to recognize the module
|
backend/__init__.py
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# empty init file for the package
|
2 |
+
# for fastapi to recognize the module
|
backend/controller.py
CHANGED
@@ -1,51 +1,106 @@
|
|
1 |
-
#
|
|
|
|
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
# internal imports
|
5 |
-
from model import mistral,
|
|
|
6 |
|
7 |
|
|
|
8 |
def interference(
|
9 |
prompt,
|
10 |
history,
|
11 |
system_prompt,
|
12 |
-
|
13 |
-
|
14 |
):
|
|
|
15 |
if system_prompt == "":
|
16 |
-
system_prompt = """
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
case _:
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
case "Mistral":
|
38 |
-
prompt_output, history_output, xai_output = "", "", ""
|
39 |
|
40 |
-
case "LlaMa 2":
|
41 |
-
prompt_output, history_output, xai_output = "", "", ""
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
|
|
|
1 |
+
# controller for the application that calls the model and explanation functions
|
2 |
+
# and returns the updated conversation history
|
3 |
+
|
4 |
+
# external imports
|
5 |
import gradio as gr
|
6 |
|
7 |
# internal imports
|
8 |
+
from model import mistral, godel
|
9 |
+
from explanation import interpret, visualize
|
10 |
|
11 |
|
12 |
+
# main interference function that that calls chat functions depending on selections
|
13 |
def interference(
|
14 |
prompt,
|
15 |
history,
|
16 |
system_prompt,
|
17 |
+
model_selection,
|
18 |
+
xai_selection,
|
19 |
):
|
20 |
+
# if no system prompt is given, use a default one
|
21 |
if system_prompt == "":
|
22 |
+
system_prompt = """
|
23 |
+
You are a helpful, respectful and honest assistant.
|
24 |
+
Always answer as helpfully as possible, while being safe.
|
25 |
+
"""
|
26 |
+
|
27 |
+
# grabs the model instance depending on the selection
|
28 |
+
match model_selection.lower():
|
29 |
+
case "mistral":
|
30 |
+
model = mistral
|
31 |
+
case "godel":
|
32 |
+
model = godel
|
33 |
+
case _:
|
34 |
+
# use Gradio warning to display error message
|
35 |
+
gr.Warning(
|
36 |
+
f'There was an error in the selected model. It is "{model_selection}"'
|
37 |
+
)
|
38 |
+
raise RuntimeError("There was an error in the selected model.")
|
39 |
+
|
40 |
+
# additionally, if the XAI approach is selected, grab the XAI instance
|
41 |
+
if xai_selection in ("SHAP", "Visualizer"):
|
42 |
+
match xai_selection.lower():
|
43 |
+
case "shap":
|
44 |
+
xai = interpret
|
45 |
+
case "visualizer":
|
46 |
+
xai = visualize
|
47 |
case _:
|
48 |
+
# use Gradio warning to display error message
|
49 |
+
gr.Warning(
|
50 |
+
f"""
|
51 |
+
There was an error in the selected XAI Approach.
|
52 |
+
It is "{xai_selection}"
|
53 |
+
"""
|
54 |
+
)
|
55 |
+
raise RuntimeError("There was an error in the selected XAI approach.")
|
56 |
|
57 |
+
# call the explained chat function
|
58 |
+
prompt_output, history_output, xai_graphic, xai_plot = explained_chat(
|
59 |
+
model=model,
|
60 |
+
xai=xai,
|
61 |
+
message=prompt,
|
62 |
+
history=history,
|
63 |
+
system_prompt=system_prompt,
|
64 |
+
)
|
65 |
+
# if no (or invalid) XAI approach is selected call the vanilla chat function
|
66 |
+
else:
|
67 |
+
# call the vanilla chat function
|
68 |
+
prompt_output, history_output = vanilla_chat(
|
69 |
+
model=model,
|
70 |
+
message=prompt,
|
71 |
+
history=history,
|
72 |
+
system_prompt=system_prompt,
|
73 |
+
)
|
74 |
+
# set XAI outputs to disclaimer html/none
|
75 |
+
xai_graphic, xai_plot = "<div><h1>No Graphic to Display</h1></div>", None
|
76 |
|
77 |
+
# return the outputs
|
78 |
+
return prompt_output, history_output, xai_graphic, xai_plot
|
|
|
|
|
79 |
|
|
|
|
|
80 |
|
81 |
+
# simple chat function that calls the model
|
82 |
+
# formats prompts, calls for an answer and returns updated conversation history
|
83 |
+
def vanilla_chat(model, message: str, history: list, system_prompt: str):
|
84 |
+
# formatting the prompt using the model's format_prompt function
|
85 |
+
prompt = model.format_prompt(message, history, system_prompt)
|
86 |
+
# generating an answer using the model's respond function
|
87 |
+
answer = model.respond(prompt)
|
88 |
|
89 |
+
# updating the chat history with the new answer
|
90 |
+
history.append((prompt, answer))
|
91 |
+
|
92 |
+
# returning the updated history
|
93 |
+
return "", history
|
94 |
+
|
95 |
+
|
96 |
+
def explained_chat(model, xai, message: str, history: list, system_prompt: str):
|
97 |
+
# formatting the prompt using the model's format_prompt function
|
98 |
+
prompt = model.format_prompt(message, history, system_prompt)
|
99 |
+
|
100 |
+
# generating an answer using the xai methods explain and respond function
|
101 |
+
answer, xai_graphic, xai_plot = xai.chat_explained(model, prompt)
|
102 |
+
# updating the chat history with the new answer
|
103 |
+
history.append((prompt, answer))
|
104 |
|
105 |
+
# returning the updated history, xai graphic and xai plot elements
|
106 |
+
return "", [["", ""]], xai_graphic, xai_plot
|
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,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from .iframe import iframe
|
2 |
+
|
3 |
+
__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/backend/gradio_iframe/templates/component/index.js
ADDED
@@ -0,0 +1,1994 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const {
|
2 |
+
SvelteComponent: lt,
|
3 |
+
attr: he,
|
4 |
+
detach: nt,
|
5 |
+
element: it,
|
6 |
+
init: st,
|
7 |
+
insert: ft,
|
8 |
+
noop: we,
|
9 |
+
safe_not_equal: ot,
|
10 |
+
toggle_class: W
|
11 |
+
} = window.__gradio__svelte__internal, { createEventDispatcher: at } = window.__gradio__svelte__internal;
|
12 |
+
function rt(n) {
|
13 |
+
let t, e;
|
14 |
+
return {
|
15 |
+
c() {
|
16 |
+
t = it("div"), he(t, "class", e = "prose " + /*elem_classes*/
|
17 |
+
n[0].join(" ") + " svelte-2qygph"), W(
|
18 |
+
t,
|
19 |
+
"min",
|
20 |
+
/*min_height*/
|
21 |
+
n[3]
|
22 |
+
), W(t, "hide", !/*visible*/
|
23 |
+
n[2]);
|
24 |
+
},
|
25 |
+
m(l, i) {
|
26 |
+
ft(l, t, i), t.innerHTML = /*value*/
|
27 |
+
n[1];
|
28 |
+
},
|
29 |
+
p(l, [i]) {
|
30 |
+
i & /*value*/
|
31 |
+
2 && (t.innerHTML = /*value*/
|
32 |
+
l[1]), i & /*elem_classes*/
|
33 |
+
1 && e !== (e = "prose " + /*elem_classes*/
|
34 |
+
l[0].join(" ") + " svelte-2qygph") && he(t, "class", e), i & /*elem_classes, min_height*/
|
35 |
+
9 && W(
|
36 |
+
t,
|
37 |
+
"min",
|
38 |
+
/*min_height*/
|
39 |
+
l[3]
|
40 |
+
), i & /*elem_classes, visible*/
|
41 |
+
5 && W(t, "hide", !/*visible*/
|
42 |
+
l[2]);
|
43 |
+
},
|
44 |
+
i: we,
|
45 |
+
o: we,
|
46 |
+
d(l) {
|
47 |
+
l && nt(t);
|
48 |
+
}
|
49 |
+
};
|
50 |
+
}
|
51 |
+
function _t(n, t, e) {
|
52 |
+
let { elem_classes: l = [] } = t, { value: i } = t, { visible: f = !0 } = t, { min_height: o = !1 } = t;
|
53 |
+
const a = at();
|
54 |
+
return n.$$set = (r) => {
|
55 |
+
"elem_classes" in r && e(0, l = r.elem_classes), "value" in r && e(1, i = r.value), "visible" in r && e(2, f = r.visible), "min_height" in r && e(3, o = r.min_height);
|
56 |
+
}, n.$$.update = () => {
|
57 |
+
n.$$.dirty & /*value*/
|
58 |
+
2 && a("change");
|
59 |
+
}, [l, i, f, o];
|
60 |
+
}
|
61 |
+
class ut extends lt {
|
62 |
+
constructor(t) {
|
63 |
+
super(), st(this, t, _t, rt, ot, {
|
64 |
+
elem_classes: 0,
|
65 |
+
value: 1,
|
66 |
+
visible: 2,
|
67 |
+
min_height: 3
|
68 |
+
});
|
69 |
+
}
|
70 |
+
}
|
71 |
+
function X(n) {
|
72 |
+
let t = ["", "k", "M", "G", "T", "P", "E", "Z"], e = 0;
|
73 |
+
for (; n > 1e3 && e < t.length - 1; )
|
74 |
+
n /= 1e3, e++;
|
75 |
+
let l = t[e];
|
76 |
+
return (Number.isInteger(n) ? n : n.toFixed(1)) + l;
|
77 |
+
}
|
78 |
+
function ee() {
|
79 |
+
}
|
80 |
+
function ct(n, t) {
|
81 |
+
return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
|
82 |
+
}
|
83 |
+
const Oe = typeof window < "u";
|
84 |
+
let ve = Oe ? () => window.performance.now() : () => Date.now(), Re = Oe ? (n) => requestAnimationFrame(n) : ee;
|
85 |
+
const Y = /* @__PURE__ */ new Set();
|
86 |
+
function Ue(n) {
|
87 |
+
Y.forEach((t) => {
|
88 |
+
t.c(n) || (Y.delete(t), t.f());
|
89 |
+
}), Y.size !== 0 && Re(Ue);
|
90 |
+
}
|
91 |
+
function dt(n) {
|
92 |
+
let t;
|
93 |
+
return Y.size === 0 && Re(Ue), {
|
94 |
+
promise: new Promise((e) => {
|
95 |
+
Y.add(t = { c: n, f: e });
|
96 |
+
}),
|
97 |
+
abort() {
|
98 |
+
Y.delete(t);
|
99 |
+
}
|
100 |
+
};
|
101 |
+
}
|
102 |
+
const H = [];
|
103 |
+
function mt(n, t = ee) {
|
104 |
+
let e;
|
105 |
+
const l = /* @__PURE__ */ new Set();
|
106 |
+
function i(a) {
|
107 |
+
if (ct(n, a) && (n = a, e)) {
|
108 |
+
const r = !H.length;
|
109 |
+
for (const s of l)
|
110 |
+
s[1](), H.push(s, n);
|
111 |
+
if (r) {
|
112 |
+
for (let s = 0; s < H.length; s += 2)
|
113 |
+
H[s][0](H[s + 1]);
|
114 |
+
H.length = 0;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
function f(a) {
|
119 |
+
i(a(n));
|
120 |
+
}
|
121 |
+
function o(a, r = ee) {
|
122 |
+
const s = [a, r];
|
123 |
+
return l.add(s), l.size === 1 && (e = t(i, f) || ee), a(n), () => {
|
124 |
+
l.delete(s), l.size === 0 && e && (e(), e = null);
|
125 |
+
};
|
126 |
+
}
|
127 |
+
return { set: i, update: f, subscribe: o };
|
128 |
+
}
|
129 |
+
function ye(n) {
|
130 |
+
return Object.prototype.toString.call(n) === "[object Date]";
|
131 |
+
}
|
132 |
+
function se(n, t, e, l) {
|
133 |
+
if (typeof e == "number" || ye(e)) {
|
134 |
+
const i = l - e, f = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * f, r = (o - a) * n.inv_mass, s = (f + r) * n.dt;
|
135 |
+
return Math.abs(s) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ye(e) ? new Date(e.getTime() + s) : e + s);
|
136 |
+
} else {
|
137 |
+
if (Array.isArray(e))
|
138 |
+
return e.map(
|
139 |
+
(i, f) => se(n, t[f], e[f], l[f])
|
140 |
+
);
|
141 |
+
if (typeof e == "object") {
|
142 |
+
const i = {};
|
143 |
+
for (const f in e)
|
144 |
+
i[f] = se(n, t[f], e[f], l[f]);
|
145 |
+
return i;
|
146 |
+
} else
|
147 |
+
throw new Error(`Cannot spring ${typeof e} values`);
|
148 |
+
}
|
149 |
+
}
|
150 |
+
function ke(n, t = {}) {
|
151 |
+
const e = mt(n), { stiffness: l = 0.15, damping: i = 0.8, precision: f = 0.01 } = t;
|
152 |
+
let o, a, r, s = n, _ = n, c = 1, w = 0, h = !1;
|
153 |
+
function y(p, L = {}) {
|
154 |
+
_ = p;
|
155 |
+
const F = r = {};
|
156 |
+
return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (h = !0, o = ve(), s = p, e.set(n = _), Promise.resolve()) : (L.soft && (w = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), c = 0), a || (o = ve(), h = !1, a = dt((u) => {
|
157 |
+
if (h)
|
158 |
+
return h = !1, a = null, !1;
|
159 |
+
c = Math.min(c + w, 1);
|
160 |
+
const k = {
|
161 |
+
inv_mass: c,
|
162 |
+
opts: C,
|
163 |
+
settled: !0,
|
164 |
+
dt: (u - o) * 60 / 1e3
|
165 |
+
}, m = se(k, s, n, _);
|
166 |
+
return o = u, s = n, e.set(n = m), k.settled && (a = null), !k.settled;
|
167 |
+
})), new Promise((u) => {
|
168 |
+
a.promise.then(() => {
|
169 |
+
F === r && u();
|
170 |
+
});
|
171 |
+
}));
|
172 |
+
}
|
173 |
+
const C = {
|
174 |
+
set: y,
|
175 |
+
update: (p, L) => y(p(_, n), L),
|
176 |
+
subscribe: e.subscribe,
|
177 |
+
stiffness: l,
|
178 |
+
damping: i,
|
179 |
+
precision: f
|
180 |
+
};
|
181 |
+
return C;
|
182 |
+
}
|
183 |
+
const {
|
184 |
+
SvelteComponent: bt,
|
185 |
+
append: N,
|
186 |
+
attr: v,
|
187 |
+
component_subscribe: pe,
|
188 |
+
detach: gt,
|
189 |
+
element: ht,
|
190 |
+
init: wt,
|
191 |
+
insert: vt,
|
192 |
+
noop: qe,
|
193 |
+
safe_not_equal: yt,
|
194 |
+
set_style: x,
|
195 |
+
svg_element: T,
|
196 |
+
toggle_class: Fe
|
197 |
+
} = window.__gradio__svelte__internal, { onMount: kt } = window.__gradio__svelte__internal;
|
198 |
+
function pt(n) {
|
199 |
+
let t, e, l, i, f, o, a, r, s, _, c, w;
|
200 |
+
return {
|
201 |
+
c() {
|
202 |
+
t = ht("div"), e = T("svg"), l = T("g"), i = T("path"), f = T("path"), o = T("path"), a = T("path"), r = T("g"), s = T("path"), _ = T("path"), c = T("path"), w = T("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(f, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(f, "fill", "#FF7C00"), v(f, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), x(l, "transform", "translate(" + /*$top*/
|
203 |
+
n[1][0] + "px, " + /*$top*/
|
204 |
+
n[1][1] + "px)"), v(s, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(s, "fill", "#FF7C00"), v(s, "fill-opacity", "0.4"), v(s, "class", "svelte-43sxxs"), v(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(_, "fill", "#FF7C00"), v(_, "class", "svelte-43sxxs"), v(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(c, "fill", "#FF7C00"), v(c, "fill-opacity", "0.4"), v(c, "class", "svelte-43sxxs"), v(w, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(w, "fill", "#FF7C00"), v(w, "class", "svelte-43sxxs"), x(r, "transform", "translate(" + /*$bottom*/
|
205 |
+
n[2][0] + "px, " + /*$bottom*/
|
206 |
+
n[2][1] + "px)"), v(e, "viewBox", "-1200 -1200 3000 3000"), v(e, "fill", "none"), v(e, "xmlns", "http://www.w3.org/2000/svg"), v(e, "class", "svelte-43sxxs"), v(t, "class", "svelte-43sxxs"), Fe(
|
207 |
+
t,
|
208 |
+
"margin",
|
209 |
+
/*margin*/
|
210 |
+
n[0]
|
211 |
+
);
|
212 |
+
},
|
213 |
+
m(h, y) {
|
214 |
+
vt(h, t, y), N(t, e), N(e, l), N(l, i), N(l, f), N(l, o), N(l, a), N(e, r), N(r, s), N(r, _), N(r, c), N(r, w);
|
215 |
+
},
|
216 |
+
p(h, [y]) {
|
217 |
+
y & /*$top*/
|
218 |
+
2 && x(l, "transform", "translate(" + /*$top*/
|
219 |
+
h[1][0] + "px, " + /*$top*/
|
220 |
+
h[1][1] + "px)"), y & /*$bottom*/
|
221 |
+
4 && x(r, "transform", "translate(" + /*$bottom*/
|
222 |
+
h[2][0] + "px, " + /*$bottom*/
|
223 |
+
h[2][1] + "px)"), y & /*margin*/
|
224 |
+
1 && Fe(
|
225 |
+
t,
|
226 |
+
"margin",
|
227 |
+
/*margin*/
|
228 |
+
h[0]
|
229 |
+
);
|
230 |
+
},
|
231 |
+
i: qe,
|
232 |
+
o: qe,
|
233 |
+
d(h) {
|
234 |
+
h && gt(t);
|
235 |
+
}
|
236 |
+
};
|
237 |
+
}
|
238 |
+
function qt(n, t, e) {
|
239 |
+
let l, i, { margin: f = !0 } = t;
|
240 |
+
const o = ke([0, 0]);
|
241 |
+
pe(n, o, (w) => e(1, l = w));
|
242 |
+
const a = ke([0, 0]);
|
243 |
+
pe(n, a, (w) => e(2, i = w));
|
244 |
+
let r;
|
245 |
+
async function s() {
|
246 |
+
await Promise.all([o.set([125, 140]), a.set([-125, -140])]), await Promise.all([o.set([-125, 140]), a.set([125, -140])]), await Promise.all([o.set([-125, 0]), a.set([125, -0])]), await Promise.all([o.set([125, 0]), a.set([-125, 0])]);
|
247 |
+
}
|
248 |
+
async function _() {
|
249 |
+
await s(), r || _();
|
250 |
+
}
|
251 |
+
async function c() {
|
252 |
+
await Promise.all([o.set([125, 0]), a.set([-125, 0])]), _();
|
253 |
+
}
|
254 |
+
return kt(() => (c(), () => r = !0)), n.$$set = (w) => {
|
255 |
+
"margin" in w && e(0, f = w.margin);
|
256 |
+
}, [f, l, i, o, a];
|
257 |
+
}
|
258 |
+
class Ft extends bt {
|
259 |
+
constructor(t) {
|
260 |
+
super(), wt(this, t, qt, pt, yt, { margin: 0 });
|
261 |
+
}
|
262 |
+
}
|
263 |
+
const {
|
264 |
+
SvelteComponent: Lt,
|
265 |
+
append: I,
|
266 |
+
attr: z,
|
267 |
+
binding_callbacks: Le,
|
268 |
+
check_outros: Je,
|
269 |
+
create_component: Ct,
|
270 |
+
create_slot: Mt,
|
271 |
+
destroy_component: Vt,
|
272 |
+
destroy_each: Ke,
|
273 |
+
detach: b,
|
274 |
+
element: P,
|
275 |
+
empty: R,
|
276 |
+
ensure_array_like: te,
|
277 |
+
get_all_dirty_from_scope: St,
|
278 |
+
get_slot_changes: Nt,
|
279 |
+
group_outros: Qe,
|
280 |
+
init: Tt,
|
281 |
+
insert: g,
|
282 |
+
mount_component: zt,
|
283 |
+
noop: fe,
|
284 |
+
safe_not_equal: jt,
|
285 |
+
set_data: S,
|
286 |
+
set_style: A,
|
287 |
+
space: j,
|
288 |
+
text: q,
|
289 |
+
toggle_class: V,
|
290 |
+
transition_in: G,
|
291 |
+
transition_out: O,
|
292 |
+
update_slot_base: Pt
|
293 |
+
} = window.__gradio__svelte__internal, { tick: Zt } = window.__gradio__svelte__internal, { onDestroy: Bt } = window.__gradio__svelte__internal, At = (n) => ({}), Ce = (n) => ({});
|
294 |
+
function Me(n, t, e) {
|
295 |
+
const l = n.slice();
|
296 |
+
return l[38] = t[e], l[40] = e, l;
|
297 |
+
}
|
298 |
+
function Ve(n, t, e) {
|
299 |
+
const l = n.slice();
|
300 |
+
return l[38] = t[e], l;
|
301 |
+
}
|
302 |
+
function Dt(n) {
|
303 |
+
let t, e = (
|
304 |
+
/*i18n*/
|
305 |
+
n[1]("common.error") + ""
|
306 |
+
), l, i, f;
|
307 |
+
const o = (
|
308 |
+
/*#slots*/
|
309 |
+
n[29].error
|
310 |
+
), a = Mt(
|
311 |
+
o,
|
312 |
+
n,
|
313 |
+
/*$$scope*/
|
314 |
+
n[28],
|
315 |
+
Ce
|
316 |
+
);
|
317 |
+
return {
|
318 |
+
c() {
|
319 |
+
t = P("span"), l = q(e), i = j(), a && a.c(), z(t, "class", "error svelte-1txqlrd");
|
320 |
+
},
|
321 |
+
m(r, s) {
|
322 |
+
g(r, t, s), I(t, l), g(r, i, s), a && a.m(r, s), f = !0;
|
323 |
+
},
|
324 |
+
p(r, s) {
|
325 |
+
(!f || s[0] & /*i18n*/
|
326 |
+
2) && e !== (e = /*i18n*/
|
327 |
+
r[1]("common.error") + "") && S(l, e), a && a.p && (!f || s[0] & /*$$scope*/
|
328 |
+
268435456) && Pt(
|
329 |
+
a,
|
330 |
+
o,
|
331 |
+
r,
|
332 |
+
/*$$scope*/
|
333 |
+
r[28],
|
334 |
+
f ? Nt(
|
335 |
+
o,
|
336 |
+
/*$$scope*/
|
337 |
+
r[28],
|
338 |
+
s,
|
339 |
+
At
|
340 |
+
) : St(
|
341 |
+
/*$$scope*/
|
342 |
+
r[28]
|
343 |
+
),
|
344 |
+
Ce
|
345 |
+
);
|
346 |
+
},
|
347 |
+
i(r) {
|
348 |
+
f || (G(a, r), f = !0);
|
349 |
+
},
|
350 |
+
o(r) {
|
351 |
+
O(a, r), f = !1;
|
352 |
+
},
|
353 |
+
d(r) {
|
354 |
+
r && (b(t), b(i)), a && a.d(r);
|
355 |
+
}
|
356 |
+
};
|
357 |
+
}
|
358 |
+
function Et(n) {
|
359 |
+
let t, e, l, i, f, o, a, r, s, _ = (
|
360 |
+
/*variant*/
|
361 |
+
n[8] === "default" && /*show_eta_bar*/
|
362 |
+
n[18] && /*show_progress*/
|
363 |
+
n[6] === "full" && Se(n)
|
364 |
+
);
|
365 |
+
function c(u, k) {
|
366 |
+
if (
|
367 |
+
/*progress*/
|
368 |
+
u[7]
|
369 |
+
)
|
370 |
+
return Xt;
|
371 |
+
if (
|
372 |
+
/*queue_position*/
|
373 |
+
u[2] !== null && /*queue_size*/
|
374 |
+
u[3] !== void 0 && /*queue_position*/
|
375 |
+
u[2] >= 0
|
376 |
+
)
|
377 |
+
return Ht;
|
378 |
+
if (
|
379 |
+
/*queue_position*/
|
380 |
+
u[2] === 0
|
381 |
+
)
|
382 |
+
return It;
|
383 |
+
}
|
384 |
+
let w = c(n), h = w && w(n), y = (
|
385 |
+
/*timer*/
|
386 |
+
n[5] && ze(n)
|
387 |
+
);
|
388 |
+
const C = [Rt, Ot], p = [];
|
389 |
+
function L(u, k) {
|
390 |
+
return (
|
391 |
+
/*last_progress_level*/
|
392 |
+
u[15] != null ? 0 : (
|
393 |
+
/*show_progress*/
|
394 |
+
u[6] === "full" ? 1 : -1
|
395 |
+
)
|
396 |
+
);
|
397 |
+
}
|
398 |
+
~(f = L(n)) && (o = p[f] = C[f](n));
|
399 |
+
let F = !/*timer*/
|
400 |
+
n[5] && Ee(n);
|
401 |
+
return {
|
402 |
+
c() {
|
403 |
+
_ && _.c(), t = j(), e = P("div"), h && h.c(), l = j(), y && y.c(), i = j(), o && o.c(), a = j(), F && F.c(), r = R(), z(e, "class", "progress-text svelte-1txqlrd"), V(
|
404 |
+
e,
|
405 |
+
"meta-text-center",
|
406 |
+
/*variant*/
|
407 |
+
n[8] === "center"
|
408 |
+
), V(
|
409 |
+
e,
|
410 |
+
"meta-text",
|
411 |
+
/*variant*/
|
412 |
+
n[8] === "default"
|
413 |
+
);
|
414 |
+
},
|
415 |
+
m(u, k) {
|
416 |
+
_ && _.m(u, k), g(u, t, k), g(u, e, k), h && h.m(e, null), I(e, l), y && y.m(e, null), g(u, i, k), ~f && p[f].m(u, k), g(u, a, k), F && F.m(u, k), g(u, r, k), s = !0;
|
417 |
+
},
|
418 |
+
p(u, k) {
|
419 |
+
/*variant*/
|
420 |
+
u[8] === "default" && /*show_eta_bar*/
|
421 |
+
u[18] && /*show_progress*/
|
422 |
+
u[6] === "full" ? _ ? _.p(u, k) : (_ = Se(u), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), w === (w = c(u)) && h ? h.p(u, k) : (h && h.d(1), h = w && w(u), h && (h.c(), h.m(e, l))), /*timer*/
|
423 |
+
u[5] ? y ? y.p(u, k) : (y = ze(u), y.c(), y.m(e, null)) : y && (y.d(1), y = null), (!s || k[0] & /*variant*/
|
424 |
+
256) && V(
|
425 |
+
e,
|
426 |
+
"meta-text-center",
|
427 |
+
/*variant*/
|
428 |
+
u[8] === "center"
|
429 |
+
), (!s || k[0] & /*variant*/
|
430 |
+
256) && V(
|
431 |
+
e,
|
432 |
+
"meta-text",
|
433 |
+
/*variant*/
|
434 |
+
u[8] === "default"
|
435 |
+
);
|
436 |
+
let m = f;
|
437 |
+
f = L(u), f === m ? ~f && p[f].p(u, k) : (o && (Qe(), O(p[m], 1, 1, () => {
|
438 |
+
p[m] = null;
|
439 |
+
}), Je()), ~f ? (o = p[f], o ? o.p(u, k) : (o = p[f] = C[f](u), o.c()), G(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
|
440 |
+
u[5] ? F && (F.d(1), F = null) : F ? F.p(u, k) : (F = Ee(u), F.c(), F.m(r.parentNode, r));
|
441 |
+
},
|
442 |
+
i(u) {
|
443 |
+
s || (G(o), s = !0);
|
444 |
+
},
|
445 |
+
o(u) {
|
446 |
+
O(o), s = !1;
|
447 |
+
},
|
448 |
+
d(u) {
|
449 |
+
u && (b(t), b(e), b(i), b(a), b(r)), _ && _.d(u), h && h.d(), y && y.d(), ~f && p[f].d(u), F && F.d(u);
|
450 |
+
}
|
451 |
+
};
|
452 |
+
}
|
453 |
+
function Se(n) {
|
454 |
+
let t, e = `translateX(${/*eta_level*/
|
455 |
+
(n[17] || 0) * 100 - 100}%)`;
|
456 |
+
return {
|
457 |
+
c() {
|
458 |
+
t = P("div"), z(t, "class", "eta-bar svelte-1txqlrd"), A(t, "transform", e);
|
459 |
+
},
|
460 |
+
m(l, i) {
|
461 |
+
g(l, t, i);
|
462 |
+
},
|
463 |
+
p(l, i) {
|
464 |
+
i[0] & /*eta_level*/
|
465 |
+
131072 && e !== (e = `translateX(${/*eta_level*/
|
466 |
+
(l[17] || 0) * 100 - 100}%)`) && A(t, "transform", e);
|
467 |
+
},
|
468 |
+
d(l) {
|
469 |
+
l && b(t);
|
470 |
+
}
|
471 |
+
};
|
472 |
+
}
|
473 |
+
function It(n) {
|
474 |
+
let t;
|
475 |
+
return {
|
476 |
+
c() {
|
477 |
+
t = q("processing |");
|
478 |
+
},
|
479 |
+
m(e, l) {
|
480 |
+
g(e, t, l);
|
481 |
+
},
|
482 |
+
p: fe,
|
483 |
+
d(e) {
|
484 |
+
e && b(t);
|
485 |
+
}
|
486 |
+
};
|
487 |
+
}
|
488 |
+
function Ht(n) {
|
489 |
+
let t, e = (
|
490 |
+
/*queue_position*/
|
491 |
+
n[2] + 1 + ""
|
492 |
+
), l, i, f, o;
|
493 |
+
return {
|
494 |
+
c() {
|
495 |
+
t = q("queue: "), l = q(e), i = q("/"), f = q(
|
496 |
+
/*queue_size*/
|
497 |
+
n[3]
|
498 |
+
), o = q(" |");
|
499 |
+
},
|
500 |
+
m(a, r) {
|
501 |
+
g(a, t, r), g(a, l, r), g(a, i, r), g(a, f, r), g(a, o, r);
|
502 |
+
},
|
503 |
+
p(a, r) {
|
504 |
+
r[0] & /*queue_position*/
|
505 |
+
4 && e !== (e = /*queue_position*/
|
506 |
+
a[2] + 1 + "") && S(l, e), r[0] & /*queue_size*/
|
507 |
+
8 && S(
|
508 |
+
f,
|
509 |
+
/*queue_size*/
|
510 |
+
a[3]
|
511 |
+
);
|
512 |
+
},
|
513 |
+
d(a) {
|
514 |
+
a && (b(t), b(l), b(i), b(f), b(o));
|
515 |
+
}
|
516 |
+
};
|
517 |
+
}
|
518 |
+
function Xt(n) {
|
519 |
+
let t, e = te(
|
520 |
+
/*progress*/
|
521 |
+
n[7]
|
522 |
+
), l = [];
|
523 |
+
for (let i = 0; i < e.length; i += 1)
|
524 |
+
l[i] = Te(Ve(n, e, i));
|
525 |
+
return {
|
526 |
+
c() {
|
527 |
+
for (let i = 0; i < l.length; i += 1)
|
528 |
+
l[i].c();
|
529 |
+
t = R();
|
530 |
+
},
|
531 |
+
m(i, f) {
|
532 |
+
for (let o = 0; o < l.length; o += 1)
|
533 |
+
l[o] && l[o].m(i, f);
|
534 |
+
g(i, t, f);
|
535 |
+
},
|
536 |
+
p(i, f) {
|
537 |
+
if (f[0] & /*progress*/
|
538 |
+
128) {
|
539 |
+
e = te(
|
540 |
+
/*progress*/
|
541 |
+
i[7]
|
542 |
+
);
|
543 |
+
let o;
|
544 |
+
for (o = 0; o < e.length; o += 1) {
|
545 |
+
const a = Ve(i, e, o);
|
546 |
+
l[o] ? l[o].p(a, f) : (l[o] = Te(a), l[o].c(), l[o].m(t.parentNode, t));
|
547 |
+
}
|
548 |
+
for (; o < l.length; o += 1)
|
549 |
+
l[o].d(1);
|
550 |
+
l.length = e.length;
|
551 |
+
}
|
552 |
+
},
|
553 |
+
d(i) {
|
554 |
+
i && b(t), Ke(l, i);
|
555 |
+
}
|
556 |
+
};
|
557 |
+
}
|
558 |
+
function Ne(n) {
|
559 |
+
let t, e = (
|
560 |
+
/*p*/
|
561 |
+
n[38].unit + ""
|
562 |
+
), l, i, f = " ", o;
|
563 |
+
function a(_, c) {
|
564 |
+
return (
|
565 |
+
/*p*/
|
566 |
+
_[38].length != null ? Gt : Yt
|
567 |
+
);
|
568 |
+
}
|
569 |
+
let r = a(n), s = r(n);
|
570 |
+
return {
|
571 |
+
c() {
|
572 |
+
s.c(), t = j(), l = q(e), i = q(" | "), o = q(f);
|
573 |
+
},
|
574 |
+
m(_, c) {
|
575 |
+
s.m(_, c), g(_, t, c), g(_, l, c), g(_, i, c), g(_, o, c);
|
576 |
+
},
|
577 |
+
p(_, c) {
|
578 |
+
r === (r = a(_)) && s ? s.p(_, c) : (s.d(1), s = r(_), s && (s.c(), s.m(t.parentNode, t))), c[0] & /*progress*/
|
579 |
+
128 && e !== (e = /*p*/
|
580 |
+
_[38].unit + "") && S(l, e);
|
581 |
+
},
|
582 |
+
d(_) {
|
583 |
+
_ && (b(t), b(l), b(i), b(o)), s.d(_);
|
584 |
+
}
|
585 |
+
};
|
586 |
+
}
|
587 |
+
function Yt(n) {
|
588 |
+
let t = X(
|
589 |
+
/*p*/
|
590 |
+
n[38].index || 0
|
591 |
+
) + "", e;
|
592 |
+
return {
|
593 |
+
c() {
|
594 |
+
e = q(t);
|
595 |
+
},
|
596 |
+
m(l, i) {
|
597 |
+
g(l, e, i);
|
598 |
+
},
|
599 |
+
p(l, i) {
|
600 |
+
i[0] & /*progress*/
|
601 |
+
128 && t !== (t = X(
|
602 |
+
/*p*/
|
603 |
+
l[38].index || 0
|
604 |
+
) + "") && S(e, t);
|
605 |
+
},
|
606 |
+
d(l) {
|
607 |
+
l && b(e);
|
608 |
+
}
|
609 |
+
};
|
610 |
+
}
|
611 |
+
function Gt(n) {
|
612 |
+
let t = X(
|
613 |
+
/*p*/
|
614 |
+
n[38].index || 0
|
615 |
+
) + "", e, l, i = X(
|
616 |
+
/*p*/
|
617 |
+
n[38].length
|
618 |
+
) + "", f;
|
619 |
+
return {
|
620 |
+
c() {
|
621 |
+
e = q(t), l = q("/"), f = q(i);
|
622 |
+
},
|
623 |
+
m(o, a) {
|
624 |
+
g(o, e, a), g(o, l, a), g(o, f, a);
|
625 |
+
},
|
626 |
+
p(o, a) {
|
627 |
+
a[0] & /*progress*/
|
628 |
+
128 && t !== (t = X(
|
629 |
+
/*p*/
|
630 |
+
o[38].index || 0
|
631 |
+
) + "") && S(e, t), a[0] & /*progress*/
|
632 |
+
128 && i !== (i = X(
|
633 |
+
/*p*/
|
634 |
+
o[38].length
|
635 |
+
) + "") && S(f, i);
|
636 |
+
},
|
637 |
+
d(o) {
|
638 |
+
o && (b(e), b(l), b(f));
|
639 |
+
}
|
640 |
+
};
|
641 |
+
}
|
642 |
+
function Te(n) {
|
643 |
+
let t, e = (
|
644 |
+
/*p*/
|
645 |
+
n[38].index != null && Ne(n)
|
646 |
+
);
|
647 |
+
return {
|
648 |
+
c() {
|
649 |
+
e && e.c(), t = R();
|
650 |
+
},
|
651 |
+
m(l, i) {
|
652 |
+
e && e.m(l, i), g(l, t, i);
|
653 |
+
},
|
654 |
+
p(l, i) {
|
655 |
+
/*p*/
|
656 |
+
l[38].index != null ? e ? e.p(l, i) : (e = Ne(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
|
657 |
+
},
|
658 |
+
d(l) {
|
659 |
+
l && b(t), e && e.d(l);
|
660 |
+
}
|
661 |
+
};
|
662 |
+
}
|
663 |
+
function ze(n) {
|
664 |
+
let t, e = (
|
665 |
+
/*eta*/
|
666 |
+
n[0] ? `/${/*formatted_eta*/
|
667 |
+
n[19]}` : ""
|
668 |
+
), l, i;
|
669 |
+
return {
|
670 |
+
c() {
|
671 |
+
t = q(
|
672 |
+
/*formatted_timer*/
|
673 |
+
n[20]
|
674 |
+
), l = q(e), i = q("s");
|
675 |
+
},
|
676 |
+
m(f, o) {
|
677 |
+
g(f, t, o), g(f, l, o), g(f, i, o);
|
678 |
+
},
|
679 |
+
p(f, o) {
|
680 |
+
o[0] & /*formatted_timer*/
|
681 |
+
1048576 && S(
|
682 |
+
t,
|
683 |
+
/*formatted_timer*/
|
684 |
+
f[20]
|
685 |
+
), o[0] & /*eta, formatted_eta*/
|
686 |
+
524289 && e !== (e = /*eta*/
|
687 |
+
f[0] ? `/${/*formatted_eta*/
|
688 |
+
f[19]}` : "") && S(l, e);
|
689 |
+
},
|
690 |
+
d(f) {
|
691 |
+
f && (b(t), b(l), b(i));
|
692 |
+
}
|
693 |
+
};
|
694 |
+
}
|
695 |
+
function Ot(n) {
|
696 |
+
let t, e;
|
697 |
+
return t = new Ft({
|
698 |
+
props: { margin: (
|
699 |
+
/*variant*/
|
700 |
+
n[8] === "default"
|
701 |
+
) }
|
702 |
+
}), {
|
703 |
+
c() {
|
704 |
+
Ct(t.$$.fragment);
|
705 |
+
},
|
706 |
+
m(l, i) {
|
707 |
+
zt(t, l, i), e = !0;
|
708 |
+
},
|
709 |
+
p(l, i) {
|
710 |
+
const f = {};
|
711 |
+
i[0] & /*variant*/
|
712 |
+
256 && (f.margin = /*variant*/
|
713 |
+
l[8] === "default"), t.$set(f);
|
714 |
+
},
|
715 |
+
i(l) {
|
716 |
+
e || (G(t.$$.fragment, l), e = !0);
|
717 |
+
},
|
718 |
+
o(l) {
|
719 |
+
O(t.$$.fragment, l), e = !1;
|
720 |
+
},
|
721 |
+
d(l) {
|
722 |
+
Vt(t, l);
|
723 |
+
}
|
724 |
+
};
|
725 |
+
}
|
726 |
+
function Rt(n) {
|
727 |
+
let t, e, l, i, f, o = `${/*last_progress_level*/
|
728 |
+
n[15] * 100}%`, a = (
|
729 |
+
/*progress*/
|
730 |
+
n[7] != null && je(n)
|
731 |
+
);
|
732 |
+
return {
|
733 |
+
c() {
|
734 |
+
t = P("div"), e = P("div"), a && a.c(), l = j(), i = P("div"), f = P("div"), z(e, "class", "progress-level-inner svelte-1txqlrd"), z(f, "class", "progress-bar svelte-1txqlrd"), A(f, "width", o), z(i, "class", "progress-bar-wrap svelte-1txqlrd"), z(t, "class", "progress-level svelte-1txqlrd");
|
735 |
+
},
|
736 |
+
m(r, s) {
|
737 |
+
g(r, t, s), I(t, e), a && a.m(e, null), I(t, l), I(t, i), I(i, f), n[30](f);
|
738 |
+
},
|
739 |
+
p(r, s) {
|
740 |
+
/*progress*/
|
741 |
+
r[7] != null ? a ? a.p(r, s) : (a = je(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null), s[0] & /*last_progress_level*/
|
742 |
+
32768 && o !== (o = `${/*last_progress_level*/
|
743 |
+
r[15] * 100}%`) && A(f, "width", o);
|
744 |
+
},
|
745 |
+
i: fe,
|
746 |
+
o: fe,
|
747 |
+
d(r) {
|
748 |
+
r && b(t), a && a.d(), n[30](null);
|
749 |
+
}
|
750 |
+
};
|
751 |
+
}
|
752 |
+
function je(n) {
|
753 |
+
let t, e = te(
|
754 |
+
/*progress*/
|
755 |
+
n[7]
|
756 |
+
), l = [];
|
757 |
+
for (let i = 0; i < e.length; i += 1)
|
758 |
+
l[i] = De(Me(n, e, i));
|
759 |
+
return {
|
760 |
+
c() {
|
761 |
+
for (let i = 0; i < l.length; i += 1)
|
762 |
+
l[i].c();
|
763 |
+
t = R();
|
764 |
+
},
|
765 |
+
m(i, f) {
|
766 |
+
for (let o = 0; o < l.length; o += 1)
|
767 |
+
l[o] && l[o].m(i, f);
|
768 |
+
g(i, t, f);
|
769 |
+
},
|
770 |
+
p(i, f) {
|
771 |
+
if (f[0] & /*progress_level, progress*/
|
772 |
+
16512) {
|
773 |
+
e = te(
|
774 |
+
/*progress*/
|
775 |
+
i[7]
|
776 |
+
);
|
777 |
+
let o;
|
778 |
+
for (o = 0; o < e.length; o += 1) {
|
779 |
+
const a = Me(i, e, o);
|
780 |
+
l[o] ? l[o].p(a, f) : (l[o] = De(a), l[o].c(), l[o].m(t.parentNode, t));
|
781 |
+
}
|
782 |
+
for (; o < l.length; o += 1)
|
783 |
+
l[o].d(1);
|
784 |
+
l.length = e.length;
|
785 |
+
}
|
786 |
+
},
|
787 |
+
d(i) {
|
788 |
+
i && b(t), Ke(l, i);
|
789 |
+
}
|
790 |
+
};
|
791 |
+
}
|
792 |
+
function Pe(n) {
|
793 |
+
let t, e, l, i, f = (
|
794 |
+
/*i*/
|
795 |
+
n[40] !== 0 && Ut()
|
796 |
+
), o = (
|
797 |
+
/*p*/
|
798 |
+
n[38].desc != null && Ze(n)
|
799 |
+
), a = (
|
800 |
+
/*p*/
|
801 |
+
n[38].desc != null && /*progress_level*/
|
802 |
+
n[14] && /*progress_level*/
|
803 |
+
n[14][
|
804 |
+
/*i*/
|
805 |
+
n[40]
|
806 |
+
] != null && Be()
|
807 |
+
), r = (
|
808 |
+
/*progress_level*/
|
809 |
+
n[14] != null && Ae(n)
|
810 |
+
);
|
811 |
+
return {
|
812 |
+
c() {
|
813 |
+
f && f.c(), t = j(), o && o.c(), e = j(), a && a.c(), l = j(), r && r.c(), i = R();
|
814 |
+
},
|
815 |
+
m(s, _) {
|
816 |
+
f && f.m(s, _), g(s, t, _), o && o.m(s, _), g(s, e, _), a && a.m(s, _), g(s, l, _), r && r.m(s, _), g(s, i, _);
|
817 |
+
},
|
818 |
+
p(s, _) {
|
819 |
+
/*p*/
|
820 |
+
s[38].desc != null ? o ? o.p(s, _) : (o = Ze(s), o.c(), o.m(e.parentNode, e)) : o && (o.d(1), o = null), /*p*/
|
821 |
+
s[38].desc != null && /*progress_level*/
|
822 |
+
s[14] && /*progress_level*/
|
823 |
+
s[14][
|
824 |
+
/*i*/
|
825 |
+
s[40]
|
826 |
+
] != null ? a || (a = Be(), a.c(), a.m(l.parentNode, l)) : a && (a.d(1), a = null), /*progress_level*/
|
827 |
+
s[14] != null ? r ? r.p(s, _) : (r = Ae(s), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
|
828 |
+
},
|
829 |
+
d(s) {
|
830 |
+
s && (b(t), b(e), b(l), b(i)), f && f.d(s), o && o.d(s), a && a.d(s), r && r.d(s);
|
831 |
+
}
|
832 |
+
};
|
833 |
+
}
|
834 |
+
function Ut(n) {
|
835 |
+
let t;
|
836 |
+
return {
|
837 |
+
c() {
|
838 |
+
t = q(" /");
|
839 |
+
},
|
840 |
+
m(e, l) {
|
841 |
+
g(e, t, l);
|
842 |
+
},
|
843 |
+
d(e) {
|
844 |
+
e && b(t);
|
845 |
+
}
|
846 |
+
};
|
847 |
+
}
|
848 |
+
function Ze(n) {
|
849 |
+
let t = (
|
850 |
+
/*p*/
|
851 |
+
n[38].desc + ""
|
852 |
+
), e;
|
853 |
+
return {
|
854 |
+
c() {
|
855 |
+
e = q(t);
|
856 |
+
},
|
857 |
+
m(l, i) {
|
858 |
+
g(l, e, i);
|
859 |
+
},
|
860 |
+
p(l, i) {
|
861 |
+
i[0] & /*progress*/
|
862 |
+
128 && t !== (t = /*p*/
|
863 |
+
l[38].desc + "") && S(e, t);
|
864 |
+
},
|
865 |
+
d(l) {
|
866 |
+
l && b(e);
|
867 |
+
}
|
868 |
+
};
|
869 |
+
}
|
870 |
+
function Be(n) {
|
871 |
+
let t;
|
872 |
+
return {
|
873 |
+
c() {
|
874 |
+
t = q("-");
|
875 |
+
},
|
876 |
+
m(e, l) {
|
877 |
+
g(e, t, l);
|
878 |
+
},
|
879 |
+
d(e) {
|
880 |
+
e && b(t);
|
881 |
+
}
|
882 |
+
};
|
883 |
+
}
|
884 |
+
function Ae(n) {
|
885 |
+
let t = (100 * /*progress_level*/
|
886 |
+
(n[14][
|
887 |
+
/*i*/
|
888 |
+
n[40]
|
889 |
+
] || 0)).toFixed(1) + "", e, l;
|
890 |
+
return {
|
891 |
+
c() {
|
892 |
+
e = q(t), l = q("%");
|
893 |
+
},
|
894 |
+
m(i, f) {
|
895 |
+
g(i, e, f), g(i, l, f);
|
896 |
+
},
|
897 |
+
p(i, f) {
|
898 |
+
f[0] & /*progress_level*/
|
899 |
+
16384 && t !== (t = (100 * /*progress_level*/
|
900 |
+
(i[14][
|
901 |
+
/*i*/
|
902 |
+
i[40]
|
903 |
+
] || 0)).toFixed(1) + "") && S(e, t);
|
904 |
+
},
|
905 |
+
d(i) {
|
906 |
+
i && (b(e), b(l));
|
907 |
+
}
|
908 |
+
};
|
909 |
+
}
|
910 |
+
function De(n) {
|
911 |
+
let t, e = (
|
912 |
+
/*p*/
|
913 |
+
(n[38].desc != null || /*progress_level*/
|
914 |
+
n[14] && /*progress_level*/
|
915 |
+
n[14][
|
916 |
+
/*i*/
|
917 |
+
n[40]
|
918 |
+
] != null) && Pe(n)
|
919 |
+
);
|
920 |
+
return {
|
921 |
+
c() {
|
922 |
+
e && e.c(), t = R();
|
923 |
+
},
|
924 |
+
m(l, i) {
|
925 |
+
e && e.m(l, i), g(l, t, i);
|
926 |
+
},
|
927 |
+
p(l, i) {
|
928 |
+
/*p*/
|
929 |
+
l[38].desc != null || /*progress_level*/
|
930 |
+
l[14] && /*progress_level*/
|
931 |
+
l[14][
|
932 |
+
/*i*/
|
933 |
+
l[40]
|
934 |
+
] != null ? e ? e.p(l, i) : (e = Pe(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
|
935 |
+
},
|
936 |
+
d(l) {
|
937 |
+
l && b(t), e && e.d(l);
|
938 |
+
}
|
939 |
+
};
|
940 |
+
}
|
941 |
+
function Ee(n) {
|
942 |
+
let t, e;
|
943 |
+
return {
|
944 |
+
c() {
|
945 |
+
t = P("p"), e = q(
|
946 |
+
/*loading_text*/
|
947 |
+
n[9]
|
948 |
+
), z(t, "class", "loading svelte-1txqlrd");
|
949 |
+
},
|
950 |
+
m(l, i) {
|
951 |
+
g(l, t, i), I(t, e);
|
952 |
+
},
|
953 |
+
p(l, i) {
|
954 |
+
i[0] & /*loading_text*/
|
955 |
+
512 && S(
|
956 |
+
e,
|
957 |
+
/*loading_text*/
|
958 |
+
l[9]
|
959 |
+
);
|
960 |
+
},
|
961 |
+
d(l) {
|
962 |
+
l && b(t);
|
963 |
+
}
|
964 |
+
};
|
965 |
+
}
|
966 |
+
function Jt(n) {
|
967 |
+
let t, e, l, i, f;
|
968 |
+
const o = [Et, Dt], a = [];
|
969 |
+
function r(s, _) {
|
970 |
+
return (
|
971 |
+
/*status*/
|
972 |
+
s[4] === "pending" ? 0 : (
|
973 |
+
/*status*/
|
974 |
+
s[4] === "error" ? 1 : -1
|
975 |
+
)
|
976 |
+
);
|
977 |
+
}
|
978 |
+
return ~(e = r(n)) && (l = a[e] = o[e](n)), {
|
979 |
+
c() {
|
980 |
+
t = P("div"), l && l.c(), z(t, "class", i = "wrap " + /*variant*/
|
981 |
+
n[8] + " " + /*show_progress*/
|
982 |
+
n[6] + " svelte-1txqlrd"), V(t, "hide", !/*status*/
|
983 |
+
n[4] || /*status*/
|
984 |
+
n[4] === "complete" || /*show_progress*/
|
985 |
+
n[6] === "hidden"), V(
|
986 |
+
t,
|
987 |
+
"translucent",
|
988 |
+
/*variant*/
|
989 |
+
n[8] === "center" && /*status*/
|
990 |
+
(n[4] === "pending" || /*status*/
|
991 |
+
n[4] === "error") || /*translucent*/
|
992 |
+
n[11] || /*show_progress*/
|
993 |
+
n[6] === "minimal"
|
994 |
+
), V(
|
995 |
+
t,
|
996 |
+
"generating",
|
997 |
+
/*status*/
|
998 |
+
n[4] === "generating"
|
999 |
+
), V(
|
1000 |
+
t,
|
1001 |
+
"border",
|
1002 |
+
/*border*/
|
1003 |
+
n[12]
|
1004 |
+
), A(
|
1005 |
+
t,
|
1006 |
+
"position",
|
1007 |
+
/*absolute*/
|
1008 |
+
n[10] ? "absolute" : "static"
|
1009 |
+
), A(
|
1010 |
+
t,
|
1011 |
+
"padding",
|
1012 |
+
/*absolute*/
|
1013 |
+
n[10] ? "0" : "var(--size-8) 0"
|
1014 |
+
);
|
1015 |
+
},
|
1016 |
+
m(s, _) {
|
1017 |
+
g(s, t, _), ~e && a[e].m(t, null), n[31](t), f = !0;
|
1018 |
+
},
|
1019 |
+
p(s, _) {
|
1020 |
+
let c = e;
|
1021 |
+
e = r(s), e === c ? ~e && a[e].p(s, _) : (l && (Qe(), O(a[c], 1, 1, () => {
|
1022 |
+
a[c] = null;
|
1023 |
+
}), Je()), ~e ? (l = a[e], l ? l.p(s, _) : (l = a[e] = o[e](s), l.c()), G(l, 1), l.m(t, null)) : l = null), (!f || _[0] & /*variant, show_progress*/
|
1024 |
+
320 && i !== (i = "wrap " + /*variant*/
|
1025 |
+
s[8] + " " + /*show_progress*/
|
1026 |
+
s[6] + " svelte-1txqlrd")) && z(t, "class", i), (!f || _[0] & /*variant, show_progress, status, show_progress*/
|
1027 |
+
336) && V(t, "hide", !/*status*/
|
1028 |
+
s[4] || /*status*/
|
1029 |
+
s[4] === "complete" || /*show_progress*/
|
1030 |
+
s[6] === "hidden"), (!f || _[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
|
1031 |
+
2384) && V(
|
1032 |
+
t,
|
1033 |
+
"translucent",
|
1034 |
+
/*variant*/
|
1035 |
+
s[8] === "center" && /*status*/
|
1036 |
+
(s[4] === "pending" || /*status*/
|
1037 |
+
s[4] === "error") || /*translucent*/
|
1038 |
+
s[11] || /*show_progress*/
|
1039 |
+
s[6] === "minimal"
|
1040 |
+
), (!f || _[0] & /*variant, show_progress, status*/
|
1041 |
+
336) && V(
|
1042 |
+
t,
|
1043 |
+
"generating",
|
1044 |
+
/*status*/
|
1045 |
+
s[4] === "generating"
|
1046 |
+
), (!f || _[0] & /*variant, show_progress, border*/
|
1047 |
+
4416) && V(
|
1048 |
+
t,
|
1049 |
+
"border",
|
1050 |
+
/*border*/
|
1051 |
+
s[12]
|
1052 |
+
), _[0] & /*absolute*/
|
1053 |
+
1024 && A(
|
1054 |
+
t,
|
1055 |
+
"position",
|
1056 |
+
/*absolute*/
|
1057 |
+
s[10] ? "absolute" : "static"
|
1058 |
+
), _[0] & /*absolute*/
|
1059 |
+
1024 && A(
|
1060 |
+
t,
|
1061 |
+
"padding",
|
1062 |
+
/*absolute*/
|
1063 |
+
s[10] ? "0" : "var(--size-8) 0"
|
1064 |
+
);
|
1065 |
+
},
|
1066 |
+
i(s) {
|
1067 |
+
f || (G(l), f = !0);
|
1068 |
+
},
|
1069 |
+
o(s) {
|
1070 |
+
O(l), f = !1;
|
1071 |
+
},
|
1072 |
+
d(s) {
|
1073 |
+
s && b(t), ~e && a[e].d(), n[31](null);
|
1074 |
+
}
|
1075 |
+
};
|
1076 |
+
}
|
1077 |
+
let $ = [], ie = !1;
|
1078 |
+
async function Kt(n, t = !0) {
|
1079 |
+
if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
|
1080 |
+
if ($.push(n), !ie)
|
1081 |
+
ie = !0;
|
1082 |
+
else
|
1083 |
+
return;
|
1084 |
+
await Zt(), requestAnimationFrame(() => {
|
1085 |
+
let e = [0, 0];
|
1086 |
+
for (let l = 0; l < $.length; l++) {
|
1087 |
+
const f = $[l].getBoundingClientRect();
|
1088 |
+
(l === 0 || f.top + window.scrollY <= e[0]) && (e[0] = f.top + window.scrollY, e[1] = l);
|
1089 |
+
}
|
1090 |
+
window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), ie = !1, $ = [];
|
1091 |
+
});
|
1092 |
+
}
|
1093 |
+
}
|
1094 |
+
function Qt(n, t, e) {
|
1095 |
+
let l, { $$slots: i = {}, $$scope: f } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: s } = t, { queue_size: _ } = t, { status: c } = t, { scroll_to_output: w = !1 } = t, { timer: h = !0 } = t, { show_progress: y = "full" } = t, { message: C = null } = t, { progress: p = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: u = !0 } = t, { translucent: k = !1 } = t, { border: m = !1 } = t, { autoscroll: le } = t, U, J = !1, Q = 0, D = 0, ne = null, ce = 0, E = null, K, Z = null, de = !0;
|
1096 |
+
const $e = () => {
|
1097 |
+
e(25, Q = performance.now()), e(26, D = 0), J = !0, me();
|
1098 |
+
};
|
1099 |
+
function me() {
|
1100 |
+
requestAnimationFrame(() => {
|
1101 |
+
e(26, D = (performance.now() - Q) / 1e3), J && me();
|
1102 |
+
});
|
1103 |
+
}
|
1104 |
+
function be() {
|
1105 |
+
e(26, D = 0), J && (J = !1);
|
1106 |
+
}
|
1107 |
+
Bt(() => {
|
1108 |
+
J && be();
|
1109 |
+
});
|
1110 |
+
let ge = null;
|
1111 |
+
function et(d) {
|
1112 |
+
Le[d ? "unshift" : "push"](() => {
|
1113 |
+
Z = d, e(16, Z), e(7, p), e(14, E), e(15, K);
|
1114 |
+
});
|
1115 |
+
}
|
1116 |
+
function tt(d) {
|
1117 |
+
Le[d ? "unshift" : "push"](() => {
|
1118 |
+
U = d, e(13, U);
|
1119 |
+
});
|
1120 |
+
}
|
1121 |
+
return n.$$set = (d) => {
|
1122 |
+
"i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, s = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, c = d.status), "scroll_to_output" in d && e(22, w = d.scroll_to_output), "timer" in d && e(5, h = d.timer), "show_progress" in d && e(6, y = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, p = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, u = d.absolute), "translucent" in d && e(11, k = d.translucent), "border" in d && e(12, m = d.border), "autoscroll" in d && e(24, le = d.autoscroll), "$$scope" in d && e(28, f = d.$$scope);
|
1123 |
+
}, n.$$.update = () => {
|
1124 |
+
n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
|
1125 |
+
169869313 && (a === null ? e(0, a = ne) : r && e(0, a = (performance.now() - Q) / 1e3 + a), a != null && (e(19, ge = a.toFixed(1)), e(27, ne = a))), n.$$.dirty[0] & /*eta, timer_diff*/
|
1126 |
+
67108865 && e(17, ce = a === null || a <= 0 || !D ? null : Math.min(D / a, 1)), n.$$.dirty[0] & /*progress*/
|
1127 |
+
128 && p != null && e(18, de = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
|
1128 |
+
114816 && (p != null ? e(14, E = p.map((d) => {
|
1129 |
+
if (d.index != null && d.length != null)
|
1130 |
+
return d.index / d.length;
|
1131 |
+
if (d.progress != null)
|
1132 |
+
return d.progress;
|
1133 |
+
})) : e(14, E = null), E ? (e(15, K = E[E.length - 1]), Z && (K === 0 ? e(16, Z.style.transition = "0", Z) : e(16, Z.style.transition = "150ms", Z))) : e(15, K = void 0)), n.$$.dirty[0] & /*status*/
|
1134 |
+
16 && (c === "pending" ? $e() : be()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
|
1135 |
+
20979728 && U && w && (c === "pending" || c === "complete") && Kt(U, le), n.$$.dirty[0] & /*status, message*/
|
1136 |
+
8388624, n.$$.dirty[0] & /*timer_diff*/
|
1137 |
+
67108864 && e(20, l = D.toFixed(1));
|
1138 |
+
}, [
|
1139 |
+
a,
|
1140 |
+
o,
|
1141 |
+
s,
|
1142 |
+
_,
|
1143 |
+
c,
|
1144 |
+
h,
|
1145 |
+
y,
|
1146 |
+
p,
|
1147 |
+
L,
|
1148 |
+
F,
|
1149 |
+
u,
|
1150 |
+
k,
|
1151 |
+
m,
|
1152 |
+
U,
|
1153 |
+
E,
|
1154 |
+
K,
|
1155 |
+
Z,
|
1156 |
+
ce,
|
1157 |
+
de,
|
1158 |
+
ge,
|
1159 |
+
l,
|
1160 |
+
r,
|
1161 |
+
w,
|
1162 |
+
C,
|
1163 |
+
le,
|
1164 |
+
Q,
|
1165 |
+
D,
|
1166 |
+
ne,
|
1167 |
+
f,
|
1168 |
+
i,
|
1169 |
+
et,
|
1170 |
+
tt
|
1171 |
+
];
|
1172 |
+
}
|
1173 |
+
class Wt extends Lt {
|
1174 |
+
constructor(t) {
|
1175 |
+
super(), Tt(
|
1176 |
+
this,
|
1177 |
+
t,
|
1178 |
+
Qt,
|
1179 |
+
Jt,
|
1180 |
+
jt,
|
1181 |
+
{
|
1182 |
+
i18n: 1,
|
1183 |
+
eta: 0,
|
1184 |
+
queue: 21,
|
1185 |
+
queue_position: 2,
|
1186 |
+
queue_size: 3,
|
1187 |
+
status: 4,
|
1188 |
+
scroll_to_output: 22,
|
1189 |
+
timer: 5,
|
1190 |
+
show_progress: 6,
|
1191 |
+
message: 23,
|
1192 |
+
progress: 7,
|
1193 |
+
variant: 8,
|
1194 |
+
loading_text: 9,
|
1195 |
+
absolute: 10,
|
1196 |
+
translucent: 11,
|
1197 |
+
border: 12,
|
1198 |
+
autoscroll: 24
|
1199 |
+
},
|
1200 |
+
null,
|
1201 |
+
[-1, -1]
|
1202 |
+
);
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
const {
|
1206 |
+
SvelteComponent: xt,
|
1207 |
+
assign: $t,
|
1208 |
+
create_slot: el,
|
1209 |
+
detach: tl,
|
1210 |
+
element: ll,
|
1211 |
+
get_all_dirty_from_scope: nl,
|
1212 |
+
get_slot_changes: il,
|
1213 |
+
get_spread_update: sl,
|
1214 |
+
init: fl,
|
1215 |
+
insert: ol,
|
1216 |
+
safe_not_equal: al,
|
1217 |
+
set_dynamic_element_data: Ie,
|
1218 |
+
set_style: M,
|
1219 |
+
toggle_class: B,
|
1220 |
+
transition_in: We,
|
1221 |
+
transition_out: xe,
|
1222 |
+
update_slot_base: rl
|
1223 |
+
} = window.__gradio__svelte__internal;
|
1224 |
+
function _l(n) {
|
1225 |
+
let t, e, l;
|
1226 |
+
const i = (
|
1227 |
+
/*#slots*/
|
1228 |
+
n[17].default
|
1229 |
+
), f = el(
|
1230 |
+
i,
|
1231 |
+
n,
|
1232 |
+
/*$$scope*/
|
1233 |
+
n[16],
|
1234 |
+
null
|
1235 |
+
);
|
1236 |
+
let o = [
|
1237 |
+
{ "data-testid": (
|
1238 |
+
/*test_id*/
|
1239 |
+
n[7]
|
1240 |
+
) },
|
1241 |
+
{ id: (
|
1242 |
+
/*elem_id*/
|
1243 |
+
n[2]
|
1244 |
+
) },
|
1245 |
+
{
|
1246 |
+
class: e = "block " + /*elem_classes*/
|
1247 |
+
n[3].join(" ") + " svelte-1t38q2d"
|
1248 |
+
}
|
1249 |
+
], a = {};
|
1250 |
+
for (let r = 0; r < o.length; r += 1)
|
1251 |
+
a = $t(a, o[r]);
|
1252 |
+
return {
|
1253 |
+
c() {
|
1254 |
+
t = ll(
|
1255 |
+
/*tag*/
|
1256 |
+
n[14]
|
1257 |
+
), f && f.c(), Ie(
|
1258 |
+
/*tag*/
|
1259 |
+
n[14]
|
1260 |
+
)(t, a), B(
|
1261 |
+
t,
|
1262 |
+
"hidden",
|
1263 |
+
/*visible*/
|
1264 |
+
n[10] === !1
|
1265 |
+
), B(
|
1266 |
+
t,
|
1267 |
+
"padded",
|
1268 |
+
/*padding*/
|
1269 |
+
n[6]
|
1270 |
+
), B(
|
1271 |
+
t,
|
1272 |
+
"border_focus",
|
1273 |
+
/*border_mode*/
|
1274 |
+
n[5] === "focus"
|
1275 |
+
), B(t, "hide-container", !/*explicit_call*/
|
1276 |
+
n[8] && !/*container*/
|
1277 |
+
n[9]), M(t, "height", typeof /*height*/
|
1278 |
+
n[0] == "number" ? (
|
1279 |
+
/*height*/
|
1280 |
+
n[0] + "px"
|
1281 |
+
) : void 0), M(t, "width", typeof /*width*/
|
1282 |
+
n[1] == "number" ? `calc(min(${/*width*/
|
1283 |
+
n[1]}px, 100%))` : void 0), M(
|
1284 |
+
t,
|
1285 |
+
"border-style",
|
1286 |
+
/*variant*/
|
1287 |
+
n[4]
|
1288 |
+
), M(
|
1289 |
+
t,
|
1290 |
+
"overflow",
|
1291 |
+
/*allow_overflow*/
|
1292 |
+
n[11] ? "visible" : "hidden"
|
1293 |
+
), M(
|
1294 |
+
t,
|
1295 |
+
"flex-grow",
|
1296 |
+
/*scale*/
|
1297 |
+
n[12]
|
1298 |
+
), M(t, "min-width", `calc(min(${/*min_width*/
|
1299 |
+
n[13]}px, 100%))`), M(t, "border-width", "var(--block-border-width)");
|
1300 |
+
},
|
1301 |
+
m(r, s) {
|
1302 |
+
ol(r, t, s), f && f.m(t, null), l = !0;
|
1303 |
+
},
|
1304 |
+
p(r, s) {
|
1305 |
+
f && f.p && (!l || s & /*$$scope*/
|
1306 |
+
65536) && rl(
|
1307 |
+
f,
|
1308 |
+
i,
|
1309 |
+
r,
|
1310 |
+
/*$$scope*/
|
1311 |
+
r[16],
|
1312 |
+
l ? il(
|
1313 |
+
i,
|
1314 |
+
/*$$scope*/
|
1315 |
+
r[16],
|
1316 |
+
s,
|
1317 |
+
null
|
1318 |
+
) : nl(
|
1319 |
+
/*$$scope*/
|
1320 |
+
r[16]
|
1321 |
+
),
|
1322 |
+
null
|
1323 |
+
), Ie(
|
1324 |
+
/*tag*/
|
1325 |
+
r[14]
|
1326 |
+
)(t, a = sl(o, [
|
1327 |
+
(!l || s & /*test_id*/
|
1328 |
+
128) && { "data-testid": (
|
1329 |
+
/*test_id*/
|
1330 |
+
r[7]
|
1331 |
+
) },
|
1332 |
+
(!l || s & /*elem_id*/
|
1333 |
+
4) && { id: (
|
1334 |
+
/*elem_id*/
|
1335 |
+
r[2]
|
1336 |
+
) },
|
1337 |
+
(!l || s & /*elem_classes*/
|
1338 |
+
8 && e !== (e = "block " + /*elem_classes*/
|
1339 |
+
r[3].join(" ") + " svelte-1t38q2d")) && { class: e }
|
1340 |
+
])), B(
|
1341 |
+
t,
|
1342 |
+
"hidden",
|
1343 |
+
/*visible*/
|
1344 |
+
r[10] === !1
|
1345 |
+
), B(
|
1346 |
+
t,
|
1347 |
+
"padded",
|
1348 |
+
/*padding*/
|
1349 |
+
r[6]
|
1350 |
+
), B(
|
1351 |
+
t,
|
1352 |
+
"border_focus",
|
1353 |
+
/*border_mode*/
|
1354 |
+
r[5] === "focus"
|
1355 |
+
), B(t, "hide-container", !/*explicit_call*/
|
1356 |
+
r[8] && !/*container*/
|
1357 |
+
r[9]), s & /*height*/
|
1358 |
+
1 && M(t, "height", typeof /*height*/
|
1359 |
+
r[0] == "number" ? (
|
1360 |
+
/*height*/
|
1361 |
+
r[0] + "px"
|
1362 |
+
) : void 0), s & /*width*/
|
1363 |
+
2 && M(t, "width", typeof /*width*/
|
1364 |
+
r[1] == "number" ? `calc(min(${/*width*/
|
1365 |
+
r[1]}px, 100%))` : void 0), s & /*variant*/
|
1366 |
+
16 && M(
|
1367 |
+
t,
|
1368 |
+
"border-style",
|
1369 |
+
/*variant*/
|
1370 |
+
r[4]
|
1371 |
+
), s & /*allow_overflow*/
|
1372 |
+
2048 && M(
|
1373 |
+
t,
|
1374 |
+
"overflow",
|
1375 |
+
/*allow_overflow*/
|
1376 |
+
r[11] ? "visible" : "hidden"
|
1377 |
+
), s & /*scale*/
|
1378 |
+
4096 && M(
|
1379 |
+
t,
|
1380 |
+
"flex-grow",
|
1381 |
+
/*scale*/
|
1382 |
+
r[12]
|
1383 |
+
), s & /*min_width*/
|
1384 |
+
8192 && M(t, "min-width", `calc(min(${/*min_width*/
|
1385 |
+
r[13]}px, 100%))`);
|
1386 |
+
},
|
1387 |
+
i(r) {
|
1388 |
+
l || (We(f, r), l = !0);
|
1389 |
+
},
|
1390 |
+
o(r) {
|
1391 |
+
xe(f, r), l = !1;
|
1392 |
+
},
|
1393 |
+
d(r) {
|
1394 |
+
r && tl(t), f && f.d(r);
|
1395 |
+
}
|
1396 |
+
};
|
1397 |
+
}
|
1398 |
+
function ul(n) {
|
1399 |
+
let t, e = (
|
1400 |
+
/*tag*/
|
1401 |
+
n[14] && _l(n)
|
1402 |
+
);
|
1403 |
+
return {
|
1404 |
+
c() {
|
1405 |
+
e && e.c();
|
1406 |
+
},
|
1407 |
+
m(l, i) {
|
1408 |
+
e && e.m(l, i), t = !0;
|
1409 |
+
},
|
1410 |
+
p(l, [i]) {
|
1411 |
+
/*tag*/
|
1412 |
+
l[14] && e.p(l, i);
|
1413 |
+
},
|
1414 |
+
i(l) {
|
1415 |
+
t || (We(e, l), t = !0);
|
1416 |
+
},
|
1417 |
+
o(l) {
|
1418 |
+
xe(e, l), t = !1;
|
1419 |
+
},
|
1420 |
+
d(l) {
|
1421 |
+
e && e.d(l);
|
1422 |
+
}
|
1423 |
+
};
|
1424 |
+
}
|
1425 |
+
function cl(n, t, e) {
|
1426 |
+
let { $$slots: l = {}, $$scope: i } = t, { height: f = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: s = "solid" } = t, { border_mode: _ = "base" } = t, { padding: c = !0 } = t, { type: w = "normal" } = t, { test_id: h = void 0 } = t, { explicit_call: y = !1 } = t, { container: C = !0 } = t, { visible: p = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: u = 0 } = t, k = w === "fieldset" ? "fieldset" : "div";
|
1427 |
+
return n.$$set = (m) => {
|
1428 |
+
"height" in m && e(0, f = m.height), "width" in m && e(1, o = m.width), "elem_id" in m && e(2, a = m.elem_id), "elem_classes" in m && e(3, r = m.elem_classes), "variant" in m && e(4, s = m.variant), "border_mode" in m && e(5, _ = m.border_mode), "padding" in m && e(6, c = m.padding), "type" in m && e(15, w = m.type), "test_id" in m && e(7, h = m.test_id), "explicit_call" in m && e(8, y = m.explicit_call), "container" in m && e(9, C = m.container), "visible" in m && e(10, p = m.visible), "allow_overflow" in m && e(11, L = m.allow_overflow), "scale" in m && e(12, F = m.scale), "min_width" in m && e(13, u = m.min_width), "$$scope" in m && e(16, i = m.$$scope);
|
1429 |
+
}, [
|
1430 |
+
f,
|
1431 |
+
o,
|
1432 |
+
a,
|
1433 |
+
r,
|
1434 |
+
s,
|
1435 |
+
_,
|
1436 |
+
c,
|
1437 |
+
h,
|
1438 |
+
y,
|
1439 |
+
C,
|
1440 |
+
p,
|
1441 |
+
L,
|
1442 |
+
F,
|
1443 |
+
u,
|
1444 |
+
k,
|
1445 |
+
w,
|
1446 |
+
i,
|
1447 |
+
l
|
1448 |
+
];
|
1449 |
+
}
|
1450 |
+
class dl extends xt {
|
1451 |
+
constructor(t) {
|
1452 |
+
super(), fl(this, t, cl, ul, al, {
|
1453 |
+
height: 0,
|
1454 |
+
width: 1,
|
1455 |
+
elem_id: 2,
|
1456 |
+
elem_classes: 3,
|
1457 |
+
variant: 4,
|
1458 |
+
border_mode: 5,
|
1459 |
+
padding: 6,
|
1460 |
+
type: 15,
|
1461 |
+
test_id: 7,
|
1462 |
+
explicit_call: 8,
|
1463 |
+
container: 9,
|
1464 |
+
visible: 10,
|
1465 |
+
allow_overflow: 11,
|
1466 |
+
scale: 12,
|
1467 |
+
min_width: 13
|
1468 |
+
});
|
1469 |
+
}
|
1470 |
+
}
|
1471 |
+
const ml = [
|
1472 |
+
{ color: "red", primary: 600, secondary: 100 },
|
1473 |
+
{ color: "green", primary: 600, secondary: 100 },
|
1474 |
+
{ color: "blue", primary: 600, secondary: 100 },
|
1475 |
+
{ color: "yellow", primary: 500, secondary: 100 },
|
1476 |
+
{ color: "purple", primary: 600, secondary: 100 },
|
1477 |
+
{ color: "teal", primary: 600, secondary: 100 },
|
1478 |
+
{ color: "orange", primary: 600, secondary: 100 },
|
1479 |
+
{ color: "cyan", primary: 600, secondary: 100 },
|
1480 |
+
{ color: "lime", primary: 500, secondary: 100 },
|
1481 |
+
{ color: "pink", primary: 600, secondary: 100 }
|
1482 |
+
], He = {
|
1483 |
+
inherit: "inherit",
|
1484 |
+
current: "currentColor",
|
1485 |
+
transparent: "transparent",
|
1486 |
+
black: "#000",
|
1487 |
+
white: "#fff",
|
1488 |
+
slate: {
|
1489 |
+
50: "#f8fafc",
|
1490 |
+
100: "#f1f5f9",
|
1491 |
+
200: "#e2e8f0",
|
1492 |
+
300: "#cbd5e1",
|
1493 |
+
400: "#94a3b8",
|
1494 |
+
500: "#64748b",
|
1495 |
+
600: "#475569",
|
1496 |
+
700: "#334155",
|
1497 |
+
800: "#1e293b",
|
1498 |
+
900: "#0f172a",
|
1499 |
+
950: "#020617"
|
1500 |
+
},
|
1501 |
+
gray: {
|
1502 |
+
50: "#f9fafb",
|
1503 |
+
100: "#f3f4f6",
|
1504 |
+
200: "#e5e7eb",
|
1505 |
+
300: "#d1d5db",
|
1506 |
+
400: "#9ca3af",
|
1507 |
+
500: "#6b7280",
|
1508 |
+
600: "#4b5563",
|
1509 |
+
700: "#374151",
|
1510 |
+
800: "#1f2937",
|
1511 |
+
900: "#111827",
|
1512 |
+
950: "#030712"
|
1513 |
+
},
|
1514 |
+
zinc: {
|
1515 |
+
50: "#fafafa",
|
1516 |
+
100: "#f4f4f5",
|
1517 |
+
200: "#e4e4e7",
|
1518 |
+
300: "#d4d4d8",
|
1519 |
+
400: "#a1a1aa",
|
1520 |
+
500: "#71717a",
|
1521 |
+
600: "#52525b",
|
1522 |
+
700: "#3f3f46",
|
1523 |
+
800: "#27272a",
|
1524 |
+
900: "#18181b",
|
1525 |
+
950: "#09090b"
|
1526 |
+
},
|
1527 |
+
neutral: {
|
1528 |
+
50: "#fafafa",
|
1529 |
+
100: "#f5f5f5",
|
1530 |
+
200: "#e5e5e5",
|
1531 |
+
300: "#d4d4d4",
|
1532 |
+
400: "#a3a3a3",
|
1533 |
+
500: "#737373",
|
1534 |
+
600: "#525252",
|
1535 |
+
700: "#404040",
|
1536 |
+
800: "#262626",
|
1537 |
+
900: "#171717",
|
1538 |
+
950: "#0a0a0a"
|
1539 |
+
},
|
1540 |
+
stone: {
|
1541 |
+
50: "#fafaf9",
|
1542 |
+
100: "#f5f5f4",
|
1543 |
+
200: "#e7e5e4",
|
1544 |
+
300: "#d6d3d1",
|
1545 |
+
400: "#a8a29e",
|
1546 |
+
500: "#78716c",
|
1547 |
+
600: "#57534e",
|
1548 |
+
700: "#44403c",
|
1549 |
+
800: "#292524",
|
1550 |
+
900: "#1c1917",
|
1551 |
+
950: "#0c0a09"
|
1552 |
+
},
|
1553 |
+
red: {
|
1554 |
+
50: "#fef2f2",
|
1555 |
+
100: "#fee2e2",
|
1556 |
+
200: "#fecaca",
|
1557 |
+
300: "#fca5a5",
|
1558 |
+
400: "#f87171",
|
1559 |
+
500: "#ef4444",
|
1560 |
+
600: "#dc2626",
|
1561 |
+
700: "#b91c1c",
|
1562 |
+
800: "#991b1b",
|
1563 |
+
900: "#7f1d1d",
|
1564 |
+
950: "#450a0a"
|
1565 |
+
},
|
1566 |
+
orange: {
|
1567 |
+
50: "#fff7ed",
|
1568 |
+
100: "#ffedd5",
|
1569 |
+
200: "#fed7aa",
|
1570 |
+
300: "#fdba74",
|
1571 |
+
400: "#fb923c",
|
1572 |
+
500: "#f97316",
|
1573 |
+
600: "#ea580c",
|
1574 |
+
700: "#c2410c",
|
1575 |
+
800: "#9a3412",
|
1576 |
+
900: "#7c2d12",
|
1577 |
+
950: "#431407"
|
1578 |
+
},
|
1579 |
+
amber: {
|
1580 |
+
50: "#fffbeb",
|
1581 |
+
100: "#fef3c7",
|
1582 |
+
200: "#fde68a",
|
1583 |
+
300: "#fcd34d",
|
1584 |
+
400: "#fbbf24",
|
1585 |
+
500: "#f59e0b",
|
1586 |
+
600: "#d97706",
|
1587 |
+
700: "#b45309",
|
1588 |
+
800: "#92400e",
|
1589 |
+
900: "#78350f",
|
1590 |
+
950: "#451a03"
|
1591 |
+
},
|
1592 |
+
yellow: {
|
1593 |
+
50: "#fefce8",
|
1594 |
+
100: "#fef9c3",
|
1595 |
+
200: "#fef08a",
|
1596 |
+
300: "#fde047",
|
1597 |
+
400: "#facc15",
|
1598 |
+
500: "#eab308",
|
1599 |
+
600: "#ca8a04",
|
1600 |
+
700: "#a16207",
|
1601 |
+
800: "#854d0e",
|
1602 |
+
900: "#713f12",
|
1603 |
+
950: "#422006"
|
1604 |
+
},
|
1605 |
+
lime: {
|
1606 |
+
50: "#f7fee7",
|
1607 |
+
100: "#ecfccb",
|
1608 |
+
200: "#d9f99d",
|
1609 |
+
300: "#bef264",
|
1610 |
+
400: "#a3e635",
|
1611 |
+
500: "#84cc16",
|
1612 |
+
600: "#65a30d",
|
1613 |
+
700: "#4d7c0f",
|
1614 |
+
800: "#3f6212",
|
1615 |
+
900: "#365314",
|
1616 |
+
950: "#1a2e05"
|
1617 |
+
},
|
1618 |
+
green: {
|
1619 |
+
50: "#f0fdf4",
|
1620 |
+
100: "#dcfce7",
|
1621 |
+
200: "#bbf7d0",
|
1622 |
+
300: "#86efac",
|
1623 |
+
400: "#4ade80",
|
1624 |
+
500: "#22c55e",
|
1625 |
+
600: "#16a34a",
|
1626 |
+
700: "#15803d",
|
1627 |
+
800: "#166534",
|
1628 |
+
900: "#14532d",
|
1629 |
+
950: "#052e16"
|
1630 |
+
},
|
1631 |
+
emerald: {
|
1632 |
+
50: "#ecfdf5",
|
1633 |
+
100: "#d1fae5",
|
1634 |
+
200: "#a7f3d0",
|
1635 |
+
300: "#6ee7b7",
|
1636 |
+
400: "#34d399",
|
1637 |
+
500: "#10b981",
|
1638 |
+
600: "#059669",
|
1639 |
+
700: "#047857",
|
1640 |
+
800: "#065f46",
|
1641 |
+
900: "#064e3b",
|
1642 |
+
950: "#022c22"
|
1643 |
+
},
|
1644 |
+
teal: {
|
1645 |
+
50: "#f0fdfa",
|
1646 |
+
100: "#ccfbf1",
|
1647 |
+
200: "#99f6e4",
|
1648 |
+
300: "#5eead4",
|
1649 |
+
400: "#2dd4bf",
|
1650 |
+
500: "#14b8a6",
|
1651 |
+
600: "#0d9488",
|
1652 |
+
700: "#0f766e",
|
1653 |
+
800: "#115e59",
|
1654 |
+
900: "#134e4a",
|
1655 |
+
950: "#042f2e"
|
1656 |
+
},
|
1657 |
+
cyan: {
|
1658 |
+
50: "#ecfeff",
|
1659 |
+
100: "#cffafe",
|
1660 |
+
200: "#a5f3fc",
|
1661 |
+
300: "#67e8f9",
|
1662 |
+
400: "#22d3ee",
|
1663 |
+
500: "#06b6d4",
|
1664 |
+
600: "#0891b2",
|
1665 |
+
700: "#0e7490",
|
1666 |
+
800: "#155e75",
|
1667 |
+
900: "#164e63",
|
1668 |
+
950: "#083344"
|
1669 |
+
},
|
1670 |
+
sky: {
|
1671 |
+
50: "#f0f9ff",
|
1672 |
+
100: "#e0f2fe",
|
1673 |
+
200: "#bae6fd",
|
1674 |
+
300: "#7dd3fc",
|
1675 |
+
400: "#38bdf8",
|
1676 |
+
500: "#0ea5e9",
|
1677 |
+
600: "#0284c7",
|
1678 |
+
700: "#0369a1",
|
1679 |
+
800: "#075985",
|
1680 |
+
900: "#0c4a6e",
|
1681 |
+
950: "#082f49"
|
1682 |
+
},
|
1683 |
+
blue: {
|
1684 |
+
50: "#eff6ff",
|
1685 |
+
100: "#dbeafe",
|
1686 |
+
200: "#bfdbfe",
|
1687 |
+
300: "#93c5fd",
|
1688 |
+
400: "#60a5fa",
|
1689 |
+
500: "#3b82f6",
|
1690 |
+
600: "#2563eb",
|
1691 |
+
700: "#1d4ed8",
|
1692 |
+
800: "#1e40af",
|
1693 |
+
900: "#1e3a8a",
|
1694 |
+
950: "#172554"
|
1695 |
+
},
|
1696 |
+
indigo: {
|
1697 |
+
50: "#eef2ff",
|
1698 |
+
100: "#e0e7ff",
|
1699 |
+
200: "#c7d2fe",
|
1700 |
+
300: "#a5b4fc",
|
1701 |
+
400: "#818cf8",
|
1702 |
+
500: "#6366f1",
|
1703 |
+
600: "#4f46e5",
|
1704 |
+
700: "#4338ca",
|
1705 |
+
800: "#3730a3",
|
1706 |
+
900: "#312e81",
|
1707 |
+
950: "#1e1b4b"
|
1708 |
+
},
|
1709 |
+
violet: {
|
1710 |
+
50: "#f5f3ff",
|
1711 |
+
100: "#ede9fe",
|
1712 |
+
200: "#ddd6fe",
|
1713 |
+
300: "#c4b5fd",
|
1714 |
+
400: "#a78bfa",
|
1715 |
+
500: "#8b5cf6",
|
1716 |
+
600: "#7c3aed",
|
1717 |
+
700: "#6d28d9",
|
1718 |
+
800: "#5b21b6",
|
1719 |
+
900: "#4c1d95",
|
1720 |
+
950: "#2e1065"
|
1721 |
+
},
|
1722 |
+
purple: {
|
1723 |
+
50: "#faf5ff",
|
1724 |
+
100: "#f3e8ff",
|
1725 |
+
200: "#e9d5ff",
|
1726 |
+
300: "#d8b4fe",
|
1727 |
+
400: "#c084fc",
|
1728 |
+
500: "#a855f7",
|
1729 |
+
600: "#9333ea",
|
1730 |
+
700: "#7e22ce",
|
1731 |
+
800: "#6b21a8",
|
1732 |
+
900: "#581c87",
|
1733 |
+
950: "#3b0764"
|
1734 |
+
},
|
1735 |
+
fuchsia: {
|
1736 |
+
50: "#fdf4ff",
|
1737 |
+
100: "#fae8ff",
|
1738 |
+
200: "#f5d0fe",
|
1739 |
+
300: "#f0abfc",
|
1740 |
+
400: "#e879f9",
|
1741 |
+
500: "#d946ef",
|
1742 |
+
600: "#c026d3",
|
1743 |
+
700: "#a21caf",
|
1744 |
+
800: "#86198f",
|
1745 |
+
900: "#701a75",
|
1746 |
+
950: "#4a044e"
|
1747 |
+
},
|
1748 |
+
pink: {
|
1749 |
+
50: "#fdf2f8",
|
1750 |
+
100: "#fce7f3",
|
1751 |
+
200: "#fbcfe8",
|
1752 |
+
300: "#f9a8d4",
|
1753 |
+
400: "#f472b6",
|
1754 |
+
500: "#ec4899",
|
1755 |
+
600: "#db2777",
|
1756 |
+
700: "#be185d",
|
1757 |
+
800: "#9d174d",
|
1758 |
+
900: "#831843",
|
1759 |
+
950: "#500724"
|
1760 |
+
},
|
1761 |
+
rose: {
|
1762 |
+
50: "#fff1f2",
|
1763 |
+
100: "#ffe4e6",
|
1764 |
+
200: "#fecdd3",
|
1765 |
+
300: "#fda4af",
|
1766 |
+
400: "#fb7185",
|
1767 |
+
500: "#f43f5e",
|
1768 |
+
600: "#e11d48",
|
1769 |
+
700: "#be123c",
|
1770 |
+
800: "#9f1239",
|
1771 |
+
900: "#881337",
|
1772 |
+
950: "#4c0519"
|
1773 |
+
}
|
1774 |
+
};
|
1775 |
+
ml.reduce(
|
1776 |
+
(n, { color: t, primary: e, secondary: l }) => ({
|
1777 |
+
...n,
|
1778 |
+
[t]: {
|
1779 |
+
primary: He[t][e],
|
1780 |
+
secondary: He[t][l]
|
1781 |
+
}
|
1782 |
+
}),
|
1783 |
+
{}
|
1784 |
+
);
|
1785 |
+
const {
|
1786 |
+
SvelteComponent: bl,
|
1787 |
+
assign: gl,
|
1788 |
+
attr: hl,
|
1789 |
+
create_component: oe,
|
1790 |
+
destroy_component: ae,
|
1791 |
+
detach: Xe,
|
1792 |
+
element: wl,
|
1793 |
+
get_spread_object: vl,
|
1794 |
+
get_spread_update: yl,
|
1795 |
+
init: kl,
|
1796 |
+
insert: Ye,
|
1797 |
+
mount_component: re,
|
1798 |
+
safe_not_equal: pl,
|
1799 |
+
space: ql,
|
1800 |
+
toggle_class: Ge,
|
1801 |
+
transition_in: _e,
|
1802 |
+
transition_out: ue
|
1803 |
+
} = window.__gradio__svelte__internal;
|
1804 |
+
function Fl(n) {
|
1805 |
+
var r;
|
1806 |
+
let t, e, l, i, f;
|
1807 |
+
const o = [
|
1808 |
+
{ autoscroll: (
|
1809 |
+
/*gradio*/
|
1810 |
+
n[5].autoscroll
|
1811 |
+
) },
|
1812 |
+
{ i18n: (
|
1813 |
+
/*gradio*/
|
1814 |
+
n[5].i18n
|
1815 |
+
) },
|
1816 |
+
/*loading_status*/
|
1817 |
+
n[4],
|
1818 |
+
{ variant: "center" }
|
1819 |
+
];
|
1820 |
+
let a = {};
|
1821 |
+
for (let s = 0; s < o.length; s += 1)
|
1822 |
+
a = gl(a, o[s]);
|
1823 |
+
return t = new Wt({ props: a }), i = new ut({
|
1824 |
+
props: {
|
1825 |
+
min_height: (
|
1826 |
+
/*loading_status*/
|
1827 |
+
n[4] && /*loading_status*/
|
1828 |
+
((r = n[4]) == null ? void 0 : r.status) !== "complete"
|
1829 |
+
),
|
1830 |
+
value: (
|
1831 |
+
/*value*/
|
1832 |
+
n[3]
|
1833 |
+
),
|
1834 |
+
elem_classes: (
|
1835 |
+
/*elem_classes*/
|
1836 |
+
n[1]
|
1837 |
+
),
|
1838 |
+
visible: (
|
1839 |
+
/*visible*/
|
1840 |
+
n[2]
|
1841 |
+
)
|
1842 |
+
}
|
1843 |
+
}), i.$on(
|
1844 |
+
"change",
|
1845 |
+
/*change_handler*/
|
1846 |
+
n[7]
|
1847 |
+
), {
|
1848 |
+
c() {
|
1849 |
+
var s;
|
1850 |
+
oe(t.$$.fragment), e = ql(), l = wl("div"), oe(i.$$.fragment), hl(l, "class", "svelte-gqsrr7"), Ge(
|
1851 |
+
l,
|
1852 |
+
"pending",
|
1853 |
+
/*loading_status*/
|
1854 |
+
((s = n[4]) == null ? void 0 : s.status) === "pending"
|
1855 |
+
);
|
1856 |
+
},
|
1857 |
+
m(s, _) {
|
1858 |
+
re(t, s, _), Ye(s, e, _), Ye(s, l, _), re(i, l, null), f = !0;
|
1859 |
+
},
|
1860 |
+
p(s, _) {
|
1861 |
+
var h, y;
|
1862 |
+
const c = _ & /*gradio, loading_status*/
|
1863 |
+
48 ? yl(o, [
|
1864 |
+
_ & /*gradio*/
|
1865 |
+
32 && { autoscroll: (
|
1866 |
+
/*gradio*/
|
1867 |
+
s[5].autoscroll
|
1868 |
+
) },
|
1869 |
+
_ & /*gradio*/
|
1870 |
+
32 && { i18n: (
|
1871 |
+
/*gradio*/
|
1872 |
+
s[5].i18n
|
1873 |
+
) },
|
1874 |
+
_ & /*loading_status*/
|
1875 |
+
16 && vl(
|
1876 |
+
/*loading_status*/
|
1877 |
+
s[4]
|
1878 |
+
),
|
1879 |
+
o[3]
|
1880 |
+
]) : {};
|
1881 |
+
t.$set(c);
|
1882 |
+
const w = {};
|
1883 |
+
_ & /*loading_status*/
|
1884 |
+
16 && (w.min_height = /*loading_status*/
|
1885 |
+
s[4] && /*loading_status*/
|
1886 |
+
((h = s[4]) == null ? void 0 : h.status) !== "complete"), _ & /*value*/
|
1887 |
+
8 && (w.value = /*value*/
|
1888 |
+
s[3]), _ & /*elem_classes*/
|
1889 |
+
2 && (w.elem_classes = /*elem_classes*/
|
1890 |
+
s[1]), _ & /*visible*/
|
1891 |
+
4 && (w.visible = /*visible*/
|
1892 |
+
s[2]), i.$set(w), (!f || _ & /*loading_status*/
|
1893 |
+
16) && Ge(
|
1894 |
+
l,
|
1895 |
+
"pending",
|
1896 |
+
/*loading_status*/
|
1897 |
+
((y = s[4]) == null ? void 0 : y.status) === "pending"
|
1898 |
+
);
|
1899 |
+
},
|
1900 |
+
i(s) {
|
1901 |
+
f || (_e(t.$$.fragment, s), _e(i.$$.fragment, s), f = !0);
|
1902 |
+
},
|
1903 |
+
o(s) {
|
1904 |
+
ue(t.$$.fragment, s), ue(i.$$.fragment, s), f = !1;
|
1905 |
+
},
|
1906 |
+
d(s) {
|
1907 |
+
s && (Xe(e), Xe(l)), ae(t, s), ae(i);
|
1908 |
+
}
|
1909 |
+
};
|
1910 |
+
}
|
1911 |
+
function Ll(n) {
|
1912 |
+
let t, e;
|
1913 |
+
return t = new dl({
|
1914 |
+
props: {
|
1915 |
+
visible: (
|
1916 |
+
/*visible*/
|
1917 |
+
n[2]
|
1918 |
+
),
|
1919 |
+
elem_id: (
|
1920 |
+
/*elem_id*/
|
1921 |
+
n[0]
|
1922 |
+
),
|
1923 |
+
elem_classes: (
|
1924 |
+
/*elem_classes*/
|
1925 |
+
n[1]
|
1926 |
+
),
|
1927 |
+
container: !1,
|
1928 |
+
$$slots: { default: [Fl] },
|
1929 |
+
$$scope: { ctx: n }
|
1930 |
+
}
|
1931 |
+
}), {
|
1932 |
+
c() {
|
1933 |
+
oe(t.$$.fragment);
|
1934 |
+
},
|
1935 |
+
m(l, i) {
|
1936 |
+
re(t, l, i), e = !0;
|
1937 |
+
},
|
1938 |
+
p(l, [i]) {
|
1939 |
+
const f = {};
|
1940 |
+
i & /*visible*/
|
1941 |
+
4 && (f.visible = /*visible*/
|
1942 |
+
l[2]), i & /*elem_id*/
|
1943 |
+
1 && (f.elem_id = /*elem_id*/
|
1944 |
+
l[0]), i & /*elem_classes*/
|
1945 |
+
2 && (f.elem_classes = /*elem_classes*/
|
1946 |
+
l[1]), i & /*$$scope, loading_status, value, elem_classes, visible, gradio*/
|
1947 |
+
318 && (f.$$scope = { dirty: i, ctx: l }), t.$set(f);
|
1948 |
+
},
|
1949 |
+
i(l) {
|
1950 |
+
e || (_e(t.$$.fragment, l), e = !0);
|
1951 |
+
},
|
1952 |
+
o(l) {
|
1953 |
+
ue(t.$$.fragment, l), e = !1;
|
1954 |
+
},
|
1955 |
+
d(l) {
|
1956 |
+
ae(t, l);
|
1957 |
+
}
|
1958 |
+
};
|
1959 |
+
}
|
1960 |
+
function Cl(n, t, e) {
|
1961 |
+
let { label: l } = t, { elem_id: i = "" } = t, { elem_classes: f = [] } = t, { visible: o = !0 } = t, { value: a = "" } = t, { loading_status: r } = t, { gradio: s } = t;
|
1962 |
+
const _ = () => s.dispatch("change");
|
1963 |
+
return n.$$set = (c) => {
|
1964 |
+
"label" in c && e(6, l = c.label), "elem_id" in c && e(0, i = c.elem_id), "elem_classes" in c && e(1, f = c.elem_classes), "visible" in c && e(2, o = c.visible), "value" in c && e(3, a = c.value), "loading_status" in c && e(4, r = c.loading_status), "gradio" in c && e(5, s = c.gradio);
|
1965 |
+
}, n.$$.update = () => {
|
1966 |
+
n.$$.dirty & /*label, gradio*/
|
1967 |
+
96 && s.dispatch("change");
|
1968 |
+
}, [
|
1969 |
+
i,
|
1970 |
+
f,
|
1971 |
+
o,
|
1972 |
+
a,
|
1973 |
+
r,
|
1974 |
+
s,
|
1975 |
+
l,
|
1976 |
+
_
|
1977 |
+
];
|
1978 |
+
}
|
1979 |
+
class Ml extends bl {
|
1980 |
+
constructor(t) {
|
1981 |
+
super(), kl(this, t, Cl, Ll, pl, {
|
1982 |
+
label: 6,
|
1983 |
+
elem_id: 0,
|
1984 |
+
elem_classes: 1,
|
1985 |
+
visible: 2,
|
1986 |
+
value: 3,
|
1987 |
+
loading_status: 4,
|
1988 |
+
gradio: 5
|
1989 |
+
});
|
1990 |
+
}
|
1991 |
+
}
|
1992 |
+
export {
|
1993 |
+
Ml as default
|
1994 |
+
};
|
components/iframe/backend/gradio_iframe/templates/component/style.css
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.min.svelte-2qygph{min-height:var(--size-24)}.hide.svelte-2qygph{display:none}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1txqlrd.svelte-1txqlrd{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1txqlrd.svelte-1txqlrd{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.dropdown-arrow.svelte-145leq6{fill:currentColor}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.block.svelte-1t38q2d{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-lpi64a{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-lde7lt{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto;align-self:flex-end}.icon.svelte-lde7lt{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-lde7lt{color:var(--color-accent)}.icon.svelte-lde7lt:hover,.icon.svelte-lde7lt:focus{color:var(--color-accent)}div.svelte-gqsrr7{transition:.15s}.pending.svelte-gqsrr7{opacity:.2}
|
components/iframe/backend/gradio_iframe/templates/example/index.js
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const {
|
2 |
+
SvelteComponent: c,
|
3 |
+
attr: u,
|
4 |
+
detach: r,
|
5 |
+
element: o,
|
6 |
+
init: d,
|
7 |
+
insert: g,
|
8 |
+
noop: _,
|
9 |
+
safe_not_equal: v,
|
10 |
+
toggle_class: s
|
11 |
+
} = window.__gradio__svelte__internal;
|
12 |
+
function y(n) {
|
13 |
+
let e;
|
14 |
+
return {
|
15 |
+
c() {
|
16 |
+
e = o("div"), u(e, "class", "prose svelte-180qqaf"), s(
|
17 |
+
e,
|
18 |
+
"table",
|
19 |
+
/*type*/
|
20 |
+
n[1] === "table"
|
21 |
+
), s(
|
22 |
+
e,
|
23 |
+
"gallery",
|
24 |
+
/*type*/
|
25 |
+
n[1] === "gallery"
|
26 |
+
), s(
|
27 |
+
e,
|
28 |
+
"selected",
|
29 |
+
/*selected*/
|
30 |
+
n[2]
|
31 |
+
);
|
32 |
+
},
|
33 |
+
m(l, t) {
|
34 |
+
g(l, e, t), e.innerHTML = /*value*/
|
35 |
+
n[0];
|
36 |
+
},
|
37 |
+
p(l, [t]) {
|
38 |
+
t & /*value*/
|
39 |
+
1 && (e.innerHTML = /*value*/
|
40 |
+
l[0]), t & /*type*/
|
41 |
+
2 && s(
|
42 |
+
e,
|
43 |
+
"table",
|
44 |
+
/*type*/
|
45 |
+
l[1] === "table"
|
46 |
+
), t & /*type*/
|
47 |
+
2 && s(
|
48 |
+
e,
|
49 |
+
"gallery",
|
50 |
+
/*type*/
|
51 |
+
l[1] === "gallery"
|
52 |
+
), t & /*selected*/
|
53 |
+
4 && s(
|
54 |
+
e,
|
55 |
+
"selected",
|
56 |
+
/*selected*/
|
57 |
+
l[2]
|
58 |
+
);
|
59 |
+
},
|
60 |
+
i: _,
|
61 |
+
o: _,
|
62 |
+
d(l) {
|
63 |
+
l && r(e);
|
64 |
+
}
|
65 |
+
};
|
66 |
+
}
|
67 |
+
function m(n, e, l) {
|
68 |
+
let { value: t } = e, { type: i } = e, { selected: f = !1 } = e;
|
69 |
+
return n.$$set = (a) => {
|
70 |
+
"value" in a && l(0, t = a.value), "type" in a && l(1, i = a.type), "selected" in a && l(2, f = a.selected);
|
71 |
+
}, [t, i, f];
|
72 |
+
}
|
73 |
+
class b extends c {
|
74 |
+
constructor(e) {
|
75 |
+
super(), d(this, e, m, y, v, { value: 0, type: 1, selected: 2 });
|
76 |
+
}
|
77 |
+
}
|
78 |
+
export {
|
79 |
+
b as default
|
80 |
+
};
|
components/iframe/backend/gradio_iframe/templates/example/style.css
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.gallery.svelte-180qqaf{padding:var(--size-2)}
|
components/iframe/demo/__init__.py
ADDED
File without changes
|
components/iframe/demo/app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_iframe import iframe
|
3 |
+
|
4 |
+
|
5 |
+
example = iframe().example_inputs()
|
6 |
+
|
7 |
+
with gr.Blocks() as demo:
|
8 |
+
with gr.Row():
|
9 |
+
iframe(label="Blank") # blank component
|
10 |
+
iframe(value=example, label="Populated") # populated component
|
11 |
+
|
12 |
+
|
13 |
+
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,933 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/aix-ppc64": {
|
31 |
+
"version": "0.19.10",
|
32 |
+
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.10.tgz",
|
33 |
+
"integrity": "sha512-Q+mk96KJ+FZ30h9fsJl+67IjNJm3x2eX+GBWGmocAKgzp27cowCOOqSdscX80s0SpdFXZnIv/+1xD1EctFx96Q==",
|
34 |
+
"cpu": [
|
35 |
+
"ppc64"
|
36 |
+
],
|
37 |
+
"optional": true,
|
38 |
+
"os": [
|
39 |
+
"aix"
|
40 |
+
],
|
41 |
+
"engines": {
|
42 |
+
"node": ">=12"
|
43 |
+
}
|
44 |
+
},
|
45 |
+
"node_modules/@esbuild/android-arm": {
|
46 |
+
"version": "0.19.10",
|
47 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.10.tgz",
|
48 |
+
"integrity": "sha512-7W0bK7qfkw1fc2viBfrtAEkDKHatYfHzr/jKAHNr9BvkYDXPcC6bodtm8AyLJNNuqClLNaeTLuwURt4PRT9d7w==",
|
49 |
+
"cpu": [
|
50 |
+
"arm"
|
51 |
+
],
|
52 |
+
"optional": true,
|
53 |
+
"os": [
|
54 |
+
"android"
|
55 |
+
],
|
56 |
+
"engines": {
|
57 |
+
"node": ">=12"
|
58 |
+
}
|
59 |
+
},
|
60 |
+
"node_modules/@esbuild/android-arm64": {
|
61 |
+
"version": "0.19.10",
|
62 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.10.tgz",
|
63 |
+
"integrity": "sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==",
|
64 |
+
"cpu": [
|
65 |
+
"arm64"
|
66 |
+
],
|
67 |
+
"optional": true,
|
68 |
+
"os": [
|
69 |
+
"android"
|
70 |
+
],
|
71 |
+
"engines": {
|
72 |
+
"node": ">=12"
|
73 |
+
}
|
74 |
+
},
|
75 |
+
"node_modules/@esbuild/android-x64": {
|
76 |
+
"version": "0.19.10",
|
77 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.10.tgz",
|
78 |
+
"integrity": "sha512-O/nO/g+/7NlitUxETkUv/IvADKuZXyH4BHf/g/7laqKC4i/7whLpB0gvpPc2zpF0q9Q6FXS3TS75QHac9MvVWw==",
|
79 |
+
"cpu": [
|
80 |
+
"x64"
|
81 |
+
],
|
82 |
+
"optional": true,
|
83 |
+
"os": [
|
84 |
+
"android"
|
85 |
+
],
|
86 |
+
"engines": {
|
87 |
+
"node": ">=12"
|
88 |
+
}
|
89 |
+
},
|
90 |
+
"node_modules/@esbuild/darwin-arm64": {
|
91 |
+
"version": "0.19.10",
|
92 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.10.tgz",
|
93 |
+
"integrity": "sha512-YSRRs2zOpwypck+6GL3wGXx2gNP7DXzetmo5pHXLrY/VIMsS59yKfjPizQ4lLt5vEI80M41gjm2BxrGZ5U+VMA==",
|
94 |
+
"cpu": [
|
95 |
+
"arm64"
|
96 |
+
],
|
97 |
+
"optional": true,
|
98 |
+
"os": [
|
99 |
+
"darwin"
|
100 |
+
],
|
101 |
+
"engines": {
|
102 |
+
"node": ">=12"
|
103 |
+
}
|
104 |
+
},
|
105 |
+
"node_modules/@esbuild/darwin-x64": {
|
106 |
+
"version": "0.19.10",
|
107 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.10.tgz",
|
108 |
+
"integrity": "sha512-alfGtT+IEICKtNE54hbvPg13xGBe4GkVxyGWtzr+yHO7HIiRJppPDhOKq3zstTcVf8msXb/t4eavW3jCDpMSmA==",
|
109 |
+
"cpu": [
|
110 |
+
"x64"
|
111 |
+
],
|
112 |
+
"optional": true,
|
113 |
+
"os": [
|
114 |
+
"darwin"
|
115 |
+
],
|
116 |
+
"engines": {
|
117 |
+
"node": ">=12"
|
118 |
+
}
|
119 |
+
},
|
120 |
+
"node_modules/@esbuild/freebsd-arm64": {
|
121 |
+
"version": "0.19.10",
|
122 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.10.tgz",
|
123 |
+
"integrity": "sha512-dMtk1wc7FSH8CCkE854GyGuNKCewlh+7heYP/sclpOG6Cectzk14qdUIY5CrKDbkA/OczXq9WesqnPl09mj5dg==",
|
124 |
+
"cpu": [
|
125 |
+
"arm64"
|
126 |
+
],
|
127 |
+
"optional": true,
|
128 |
+
"os": [
|
129 |
+
"freebsd"
|
130 |
+
],
|
131 |
+
"engines": {
|
132 |
+
"node": ">=12"
|
133 |
+
}
|
134 |
+
},
|
135 |
+
"node_modules/@esbuild/freebsd-x64": {
|
136 |
+
"version": "0.19.10",
|
137 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.10.tgz",
|
138 |
+
"integrity": "sha512-G5UPPspryHu1T3uX8WiOEUa6q6OlQh6gNl4CO4Iw5PS+Kg5bVggVFehzXBJY6X6RSOMS8iXDv2330VzaObm4Ag==",
|
139 |
+
"cpu": [
|
140 |
+
"x64"
|
141 |
+
],
|
142 |
+
"optional": true,
|
143 |
+
"os": [
|
144 |
+
"freebsd"
|
145 |
+
],
|
146 |
+
"engines": {
|
147 |
+
"node": ">=12"
|
148 |
+
}
|
149 |
+
},
|
150 |
+
"node_modules/@esbuild/linux-arm": {
|
151 |
+
"version": "0.19.10",
|
152 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.10.tgz",
|
153 |
+
"integrity": "sha512-j6gUW5aAaPgD416Hk9FHxn27On28H4eVI9rJ4az7oCGTFW48+LcgNDBN+9f8rKZz7EEowo889CPKyeaD0iw9Kg==",
|
154 |
+
"cpu": [
|
155 |
+
"arm"
|
156 |
+
],
|
157 |
+
"optional": true,
|
158 |
+
"os": [
|
159 |
+
"linux"
|
160 |
+
],
|
161 |
+
"engines": {
|
162 |
+
"node": ">=12"
|
163 |
+
}
|
164 |
+
},
|
165 |
+
"node_modules/@esbuild/linux-arm64": {
|
166 |
+
"version": "0.19.10",
|
167 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.10.tgz",
|
168 |
+
"integrity": "sha512-QxaouHWZ+2KWEj7cGJmvTIHVALfhpGxo3WLmlYfJ+dA5fJB6lDEIg+oe/0//FuyVHuS3l79/wyBxbHr0NgtxJQ==",
|
169 |
+
"cpu": [
|
170 |
+
"arm64"
|
171 |
+
],
|
172 |
+
"optional": true,
|
173 |
+
"os": [
|
174 |
+
"linux"
|
175 |
+
],
|
176 |
+
"engines": {
|
177 |
+
"node": ">=12"
|
178 |
+
}
|
179 |
+
},
|
180 |
+
"node_modules/@esbuild/linux-ia32": {
|
181 |
+
"version": "0.19.10",
|
182 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.10.tgz",
|
183 |
+
"integrity": "sha512-4ub1YwXxYjj9h1UIZs2hYbnTZBtenPw5NfXCRgEkGb0b6OJ2gpkMvDqRDYIDRjRdWSe/TBiZltm3Y3Q8SN1xNg==",
|
184 |
+
"cpu": [
|
185 |
+
"ia32"
|
186 |
+
],
|
187 |
+
"optional": true,
|
188 |
+
"os": [
|
189 |
+
"linux"
|
190 |
+
],
|
191 |
+
"engines": {
|
192 |
+
"node": ">=12"
|
193 |
+
}
|
194 |
+
},
|
195 |
+
"node_modules/@esbuild/linux-loong64": {
|
196 |
+
"version": "0.19.10",
|
197 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.10.tgz",
|
198 |
+
"integrity": "sha512-lo3I9k+mbEKoxtoIbM0yC/MZ1i2wM0cIeOejlVdZ3D86LAcFXFRdeuZmh91QJvUTW51bOK5W2BznGNIl4+mDaA==",
|
199 |
+
"cpu": [
|
200 |
+
"loong64"
|
201 |
+
],
|
202 |
+
"optional": true,
|
203 |
+
"os": [
|
204 |
+
"linux"
|
205 |
+
],
|
206 |
+
"engines": {
|
207 |
+
"node": ">=12"
|
208 |
+
}
|
209 |
+
},
|
210 |
+
"node_modules/@esbuild/linux-mips64el": {
|
211 |
+
"version": "0.19.10",
|
212 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.10.tgz",
|
213 |
+
"integrity": "sha512-J4gH3zhHNbdZN0Bcr1QUGVNkHTdpijgx5VMxeetSk6ntdt+vR1DqGmHxQYHRmNb77tP6GVvD+K0NyO4xjd7y4A==",
|
214 |
+
"cpu": [
|
215 |
+
"mips64el"
|
216 |
+
],
|
217 |
+
"optional": true,
|
218 |
+
"os": [
|
219 |
+
"linux"
|
220 |
+
],
|
221 |
+
"engines": {
|
222 |
+
"node": ">=12"
|
223 |
+
}
|
224 |
+
},
|
225 |
+
"node_modules/@esbuild/linux-ppc64": {
|
226 |
+
"version": "0.19.10",
|
227 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.10.tgz",
|
228 |
+
"integrity": "sha512-tgT/7u+QhV6ge8wFMzaklOY7KqiyitgT1AUHMApau32ZlvTB/+efeCtMk4eXS+uEymYK249JsoiklZN64xt6oQ==",
|
229 |
+
"cpu": [
|
230 |
+
"ppc64"
|
231 |
+
],
|
232 |
+
"optional": true,
|
233 |
+
"os": [
|
234 |
+
"linux"
|
235 |
+
],
|
236 |
+
"engines": {
|
237 |
+
"node": ">=12"
|
238 |
+
}
|
239 |
+
},
|
240 |
+
"node_modules/@esbuild/linux-riscv64": {
|
241 |
+
"version": "0.19.10",
|
242 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.10.tgz",
|
243 |
+
"integrity": "sha512-0f/spw0PfBMZBNqtKe5FLzBDGo0SKZKvMl5PHYQr3+eiSscfJ96XEknCe+JoOayybWUFQbcJTrk946i3j9uYZA==",
|
244 |
+
"cpu": [
|
245 |
+
"riscv64"
|
246 |
+
],
|
247 |
+
"optional": true,
|
248 |
+
"os": [
|
249 |
+
"linux"
|
250 |
+
],
|
251 |
+
"engines": {
|
252 |
+
"node": ">=12"
|
253 |
+
}
|
254 |
+
},
|
255 |
+
"node_modules/@esbuild/linux-s390x": {
|
256 |
+
"version": "0.19.10",
|
257 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.10.tgz",
|
258 |
+
"integrity": "sha512-pZFe0OeskMHzHa9U38g+z8Yx5FNCLFtUnJtQMpwhS+r4S566aK2ci3t4NCP4tjt6d5j5uo4h7tExZMjeKoehAA==",
|
259 |
+
"cpu": [
|
260 |
+
"s390x"
|
261 |
+
],
|
262 |
+
"optional": true,
|
263 |
+
"os": [
|
264 |
+
"linux"
|
265 |
+
],
|
266 |
+
"engines": {
|
267 |
+
"node": ">=12"
|
268 |
+
}
|
269 |
+
},
|
270 |
+
"node_modules/@esbuild/linux-x64": {
|
271 |
+
"version": "0.19.10",
|
272 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.10.tgz",
|
273 |
+
"integrity": "sha512-SpYNEqg/6pZYoc+1zLCjVOYvxfZVZj6w0KROZ3Fje/QrM3nfvT2llI+wmKSrWuX6wmZeTapbarvuNNK/qepSgA==",
|
274 |
+
"cpu": [
|
275 |
+
"x64"
|
276 |
+
],
|
277 |
+
"optional": true,
|
278 |
+
"os": [
|
279 |
+
"linux"
|
280 |
+
],
|
281 |
+
"engines": {
|
282 |
+
"node": ">=12"
|
283 |
+
}
|
284 |
+
},
|
285 |
+
"node_modules/@esbuild/netbsd-x64": {
|
286 |
+
"version": "0.19.10",
|
287 |
+
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.10.tgz",
|
288 |
+
"integrity": "sha512-ACbZ0vXy9zksNArWlk2c38NdKg25+L9pr/mVaj9SUq6lHZu/35nx2xnQVRGLrC1KKQqJKRIB0q8GspiHI3J80Q==",
|
289 |
+
"cpu": [
|
290 |
+
"x64"
|
291 |
+
],
|
292 |
+
"optional": true,
|
293 |
+
"os": [
|
294 |
+
"netbsd"
|
295 |
+
],
|
296 |
+
"engines": {
|
297 |
+
"node": ">=12"
|
298 |
+
}
|
299 |
+
},
|
300 |
+
"node_modules/@esbuild/openbsd-x64": {
|
301 |
+
"version": "0.19.10",
|
302 |
+
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.10.tgz",
|
303 |
+
"integrity": "sha512-PxcgvjdSjtgPMiPQrM3pwSaG4kGphP+bLSb+cihuP0LYdZv1epbAIecHVl5sD3npkfYBZ0ZnOjR878I7MdJDFg==",
|
304 |
+
"cpu": [
|
305 |
+
"x64"
|
306 |
+
],
|
307 |
+
"optional": true,
|
308 |
+
"os": [
|
309 |
+
"openbsd"
|
310 |
+
],
|
311 |
+
"engines": {
|
312 |
+
"node": ">=12"
|
313 |
+
}
|
314 |
+
},
|
315 |
+
"node_modules/@esbuild/sunos-x64": {
|
316 |
+
"version": "0.19.10",
|
317 |
+
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.10.tgz",
|
318 |
+
"integrity": "sha512-ZkIOtrRL8SEJjr+VHjmW0znkPs+oJXhlJbNwfI37rvgeMtk3sxOQevXPXjmAPZPigVTncvFqLMd+uV0IBSEzqA==",
|
319 |
+
"cpu": [
|
320 |
+
"x64"
|
321 |
+
],
|
322 |
+
"optional": true,
|
323 |
+
"os": [
|
324 |
+
"sunos"
|
325 |
+
],
|
326 |
+
"engines": {
|
327 |
+
"node": ">=12"
|
328 |
+
}
|
329 |
+
},
|
330 |
+
"node_modules/@esbuild/win32-arm64": {
|
331 |
+
"version": "0.19.10",
|
332 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.10.tgz",
|
333 |
+
"integrity": "sha512-+Sa4oTDbpBfGpl3Hn3XiUe4f8TU2JF7aX8cOfqFYMMjXp6ma6NJDztl5FDG8Ezx0OjwGikIHw+iA54YLDNNVfw==",
|
334 |
+
"cpu": [
|
335 |
+
"arm64"
|
336 |
+
],
|
337 |
+
"optional": true,
|
338 |
+
"os": [
|
339 |
+
"win32"
|
340 |
+
],
|
341 |
+
"engines": {
|
342 |
+
"node": ">=12"
|
343 |
+
}
|
344 |
+
},
|
345 |
+
"node_modules/@esbuild/win32-ia32": {
|
346 |
+
"version": "0.19.10",
|
347 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.10.tgz",
|
348 |
+
"integrity": "sha512-EOGVLK1oWMBXgfttJdPHDTiivYSjX6jDNaATeNOaCOFEVcfMjtbx7WVQwPSE1eIfCp/CaSF2nSrDtzc4I9f8TQ==",
|
349 |
+
"cpu": [
|
350 |
+
"ia32"
|
351 |
+
],
|
352 |
+
"optional": true,
|
353 |
+
"os": [
|
354 |
+
"win32"
|
355 |
+
],
|
356 |
+
"engines": {
|
357 |
+
"node": ">=12"
|
358 |
+
}
|
359 |
+
},
|
360 |
+
"node_modules/@esbuild/win32-x64": {
|
361 |
+
"version": "0.19.10",
|
362 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.10.tgz",
|
363 |
+
"integrity": "sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==",
|
364 |
+
"cpu": [
|
365 |
+
"x64"
|
366 |
+
],
|
367 |
+
"optional": true,
|
368 |
+
"os": [
|
369 |
+
"win32"
|
370 |
+
],
|
371 |
+
"engines": {
|
372 |
+
"node": ">=12"
|
373 |
+
}
|
374 |
+
},
|
375 |
+
"node_modules/@formatjs/ecma402-abstract": {
|
376 |
+
"version": "1.11.4",
|
377 |
+
"resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz",
|
378 |
+
"integrity": "sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==",
|
379 |
+
"dependencies": {
|
380 |
+
"@formatjs/intl-localematcher": "0.2.25",
|
381 |
+
"tslib": "^2.1.0"
|
382 |
+
}
|
383 |
+
},
|
384 |
+
"node_modules/@formatjs/fast-memoize": {
|
385 |
+
"version": "1.2.1",
|
386 |
+
"resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz",
|
387 |
+
"integrity": "sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==",
|
388 |
+
"dependencies": {
|
389 |
+
"tslib": "^2.1.0"
|
390 |
+
}
|
391 |
+
},
|
392 |
+
"node_modules/@formatjs/icu-messageformat-parser": {
|
393 |
+
"version": "2.1.0",
|
394 |
+
"resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz",
|
395 |
+
"integrity": "sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw==",
|
396 |
+
"dependencies": {
|
397 |
+
"@formatjs/ecma402-abstract": "1.11.4",
|
398 |
+
"@formatjs/icu-skeleton-parser": "1.3.6",
|
399 |
+
"tslib": "^2.1.0"
|
400 |
+
}
|
401 |
+
},
|
402 |
+
"node_modules/@formatjs/icu-skeleton-parser": {
|
403 |
+
"version": "1.3.6",
|
404 |
+
"resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz",
|
405 |
+
"integrity": "sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==",
|
406 |
+
"dependencies": {
|
407 |
+
"@formatjs/ecma402-abstract": "1.11.4",
|
408 |
+
"tslib": "^2.1.0"
|
409 |
+
}
|
410 |
+
},
|
411 |
+
"node_modules/@formatjs/intl-localematcher": {
|
412 |
+
"version": "0.2.25",
|
413 |
+
"resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz",
|
414 |
+
"integrity": "sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==",
|
415 |
+
"dependencies": {
|
416 |
+
"tslib": "^2.1.0"
|
417 |
+
}
|
418 |
+
},
|
419 |
+
"node_modules/@gradio/atoms": {
|
420 |
+
"version": "0.3.0",
|
421 |
+
"resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.3.0.tgz",
|
422 |
+
"integrity": "sha512-7WQktAb+d8wEjTIYGzyQ8OdWsFSr0NA8adp8G/jAKoMZILJEoAAZSTnahCTSSQcbYIomVdfYA0ZmM342RCd8gg==",
|
423 |
+
"dependencies": {
|
424 |
+
"@gradio/icons": "^0.3.0",
|
425 |
+
"@gradio/utils": "^0.2.0"
|
426 |
+
}
|
427 |
+
},
|
428 |
+
"node_modules/@gradio/column": {
|
429 |
+
"version": "0.1.0",
|
430 |
+
"resolved": "https://registry.npmjs.org/@gradio/column/-/column-0.1.0.tgz",
|
431 |
+
"integrity": "sha512-P24nqqVnMXBaDA1f/zSN5HZRho4PxP8Dq+7VltPHlmxIEiZYik2AJ4J0LeuIha34FDO0guu/16evdrpvGIUAfw=="
|
432 |
+
},
|
433 |
+
"node_modules/@gradio/icons": {
|
434 |
+
"version": "0.3.2",
|
435 |
+
"resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.3.2.tgz",
|
436 |
+
"integrity": "sha512-l0jGfSRFiZ/doAXz6L+JEp6MN/a1BTZm88kqVoSnYrKSytP6bnBLRWeF4UvOi2T2fbVrNKenAEt/lwxJE5vK4w=="
|
437 |
+
},
|
438 |
+
"node_modules/@gradio/statustracker": {
|
439 |
+
"version": "0.4.0",
|
440 |
+
"resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.4.0.tgz",
|
441 |
+
"integrity": "sha512-Kgk4R2edFX4IK2UBit4UwmRfSrmvkYjKbiMfupj3qxHFwiDHT4YH4rAOqBlvdEWbCYMmLN6EyqqFaYb2+0GwXA==",
|
442 |
+
"dependencies": {
|
443 |
+
"@gradio/atoms": "^0.3.0",
|
444 |
+
"@gradio/column": "^0.1.0",
|
445 |
+
"@gradio/icons": "^0.3.0",
|
446 |
+
"@gradio/utils": "^0.2.0"
|
447 |
+
}
|
448 |
+
},
|
449 |
+
"node_modules/@gradio/theme": {
|
450 |
+
"version": "0.2.0",
|
451 |
+
"resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.2.0.tgz",
|
452 |
+
"integrity": "sha512-33c68Nk7oRXLn08OxPfjcPm7S4tXGOUV1I1bVgzdM2YV5o1QBOS1GEnXPZPu/CEYPePLMB6bsDwffrLEyLGWVQ=="
|
453 |
+
},
|
454 |
+
"node_modules/@gradio/utils": {
|
455 |
+
"version": "0.2.0",
|
456 |
+
"resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.2.0.tgz",
|
457 |
+
"integrity": "sha512-YkwzXufi6IxQrlMW+1sFo8Yn6F9NLL69ZoBsbo7QEhms0v5L7pmOTw+dfd7M3dwbRP2lgjrb52i1kAIN3n6aqQ==",
|
458 |
+
"dependencies": {
|
459 |
+
"@gradio/theme": "^0.2.0",
|
460 |
+
"svelte-i18n": "^3.6.0"
|
461 |
+
}
|
462 |
+
},
|
463 |
+
"node_modules/@jridgewell/gen-mapping": {
|
464 |
+
"version": "0.3.3",
|
465 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
|
466 |
+
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
|
467 |
+
"peer": true,
|
468 |
+
"dependencies": {
|
469 |
+
"@jridgewell/set-array": "^1.0.1",
|
470 |
+
"@jridgewell/sourcemap-codec": "^1.4.10",
|
471 |
+
"@jridgewell/trace-mapping": "^0.3.9"
|
472 |
+
},
|
473 |
+
"engines": {
|
474 |
+
"node": ">=6.0.0"
|
475 |
+
}
|
476 |
+
},
|
477 |
+
"node_modules/@jridgewell/resolve-uri": {
|
478 |
+
"version": "3.1.1",
|
479 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
|
480 |
+
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
|
481 |
+
"peer": true,
|
482 |
+
"engines": {
|
483 |
+
"node": ">=6.0.0"
|
484 |
+
}
|
485 |
+
},
|
486 |
+
"node_modules/@jridgewell/set-array": {
|
487 |
+
"version": "1.1.2",
|
488 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
489 |
+
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
490 |
+
"peer": true,
|
491 |
+
"engines": {
|
492 |
+
"node": ">=6.0.0"
|
493 |
+
}
|
494 |
+
},
|
495 |
+
"node_modules/@jridgewell/sourcemap-codec": {
|
496 |
+
"version": "1.4.15",
|
497 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
498 |
+
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
499 |
+
"peer": true
|
500 |
+
},
|
501 |
+
"node_modules/@jridgewell/trace-mapping": {
|
502 |
+
"version": "0.3.20",
|
503 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
|
504 |
+
"integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
|
505 |
+
"peer": true,
|
506 |
+
"dependencies": {
|
507 |
+
"@jridgewell/resolve-uri": "^3.1.0",
|
508 |
+
"@jridgewell/sourcemap-codec": "^1.4.14"
|
509 |
+
}
|
510 |
+
},
|
511 |
+
"node_modules/@types/estree": {
|
512 |
+
"version": "1.0.5",
|
513 |
+
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
514 |
+
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
|
515 |
+
"peer": true
|
516 |
+
},
|
517 |
+
"node_modules/acorn": {
|
518 |
+
"version": "8.11.2",
|
519 |
+
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
|
520 |
+
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
521 |
+
"peer": true,
|
522 |
+
"bin": {
|
523 |
+
"acorn": "bin/acorn"
|
524 |
+
},
|
525 |
+
"engines": {
|
526 |
+
"node": ">=0.4.0"
|
527 |
+
}
|
528 |
+
},
|
529 |
+
"node_modules/aria-query": {
|
530 |
+
"version": "5.3.0",
|
531 |
+
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
|
532 |
+
"integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
|
533 |
+
"peer": true,
|
534 |
+
"dependencies": {
|
535 |
+
"dequal": "^2.0.3"
|
536 |
+
}
|
537 |
+
},
|
538 |
+
"node_modules/axobject-query": {
|
539 |
+
"version": "3.2.1",
|
540 |
+
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
|
541 |
+
"integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==",
|
542 |
+
"peer": true,
|
543 |
+
"dependencies": {
|
544 |
+
"dequal": "^2.0.3"
|
545 |
+
}
|
546 |
+
},
|
547 |
+
"node_modules/cli-color": {
|
548 |
+
"version": "2.0.3",
|
549 |
+
"resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz",
|
550 |
+
"integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==",
|
551 |
+
"dependencies": {
|
552 |
+
"d": "^1.0.1",
|
553 |
+
"es5-ext": "^0.10.61",
|
554 |
+
"es6-iterator": "^2.0.3",
|
555 |
+
"memoizee": "^0.4.15",
|
556 |
+
"timers-ext": "^0.1.7"
|
557 |
+
},
|
558 |
+
"engines": {
|
559 |
+
"node": ">=0.10"
|
560 |
+
}
|
561 |
+
},
|
562 |
+
"node_modules/code-red": {
|
563 |
+
"version": "1.0.4",
|
564 |
+
"resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
|
565 |
+
"integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==",
|
566 |
+
"peer": true,
|
567 |
+
"dependencies": {
|
568 |
+
"@jridgewell/sourcemap-codec": "^1.4.15",
|
569 |
+
"@types/estree": "^1.0.1",
|
570 |
+
"acorn": "^8.10.0",
|
571 |
+
"estree-walker": "^3.0.3",
|
572 |
+
"periscopic": "^3.1.0"
|
573 |
+
}
|
574 |
+
},
|
575 |
+
"node_modules/css-tree": {
|
576 |
+
"version": "2.3.1",
|
577 |
+
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
|
578 |
+
"integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
|
579 |
+
"peer": true,
|
580 |
+
"dependencies": {
|
581 |
+
"mdn-data": "2.0.30",
|
582 |
+
"source-map-js": "^1.0.1"
|
583 |
+
},
|
584 |
+
"engines": {
|
585 |
+
"node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
|
586 |
+
}
|
587 |
+
},
|
588 |
+
"node_modules/d": {
|
589 |
+
"version": "1.0.1",
|
590 |
+
"resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
|
591 |
+
"integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
|
592 |
+
"dependencies": {
|
593 |
+
"es5-ext": "^0.10.50",
|
594 |
+
"type": "^1.0.1"
|
595 |
+
}
|
596 |
+
},
|
597 |
+
"node_modules/deepmerge": {
|
598 |
+
"version": "4.3.1",
|
599 |
+
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
600 |
+
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
601 |
+
"engines": {
|
602 |
+
"node": ">=0.10.0"
|
603 |
+
}
|
604 |
+
},
|
605 |
+
"node_modules/dequal": {
|
606 |
+
"version": "2.0.3",
|
607 |
+
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
|
608 |
+
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
|
609 |
+
"peer": true,
|
610 |
+
"engines": {
|
611 |
+
"node": ">=6"
|
612 |
+
}
|
613 |
+
},
|
614 |
+
"node_modules/es5-ext": {
|
615 |
+
"version": "0.10.62",
|
616 |
+
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz",
|
617 |
+
"integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==",
|
618 |
+
"hasInstallScript": true,
|
619 |
+
"dependencies": {
|
620 |
+
"es6-iterator": "^2.0.3",
|
621 |
+
"es6-symbol": "^3.1.3",
|
622 |
+
"next-tick": "^1.1.0"
|
623 |
+
},
|
624 |
+
"engines": {
|
625 |
+
"node": ">=0.10"
|
626 |
+
}
|
627 |
+
},
|
628 |
+
"node_modules/es6-iterator": {
|
629 |
+
"version": "2.0.3",
|
630 |
+
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
|
631 |
+
"integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
|
632 |
+
"dependencies": {
|
633 |
+
"d": "1",
|
634 |
+
"es5-ext": "^0.10.35",
|
635 |
+
"es6-symbol": "^3.1.1"
|
636 |
+
}
|
637 |
+
},
|
638 |
+
"node_modules/es6-symbol": {
|
639 |
+
"version": "3.1.3",
|
640 |
+
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
|
641 |
+
"integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
|
642 |
+
"dependencies": {
|
643 |
+
"d": "^1.0.1",
|
644 |
+
"ext": "^1.1.2"
|
645 |
+
}
|
646 |
+
},
|
647 |
+
"node_modules/es6-weak-map": {
|
648 |
+
"version": "2.0.3",
|
649 |
+
"resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
|
650 |
+
"integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
|
651 |
+
"dependencies": {
|
652 |
+
"d": "1",
|
653 |
+
"es5-ext": "^0.10.46",
|
654 |
+
"es6-iterator": "^2.0.3",
|
655 |
+
"es6-symbol": "^3.1.1"
|
656 |
+
}
|
657 |
+
},
|
658 |
+
"node_modules/esbuild": {
|
659 |
+
"version": "0.19.10",
|
660 |
+
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.10.tgz",
|
661 |
+
"integrity": "sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==",
|
662 |
+
"hasInstallScript": true,
|
663 |
+
"bin": {
|
664 |
+
"esbuild": "bin/esbuild"
|
665 |
+
},
|
666 |
+
"engines": {
|
667 |
+
"node": ">=12"
|
668 |
+
},
|
669 |
+
"optionalDependencies": {
|
670 |
+
"@esbuild/aix-ppc64": "0.19.10",
|
671 |
+
"@esbuild/android-arm": "0.19.10",
|
672 |
+
"@esbuild/android-arm64": "0.19.10",
|
673 |
+
"@esbuild/android-x64": "0.19.10",
|
674 |
+
"@esbuild/darwin-arm64": "0.19.10",
|
675 |
+
"@esbuild/darwin-x64": "0.19.10",
|
676 |
+
"@esbuild/freebsd-arm64": "0.19.10",
|
677 |
+
"@esbuild/freebsd-x64": "0.19.10",
|
678 |
+
"@esbuild/linux-arm": "0.19.10",
|
679 |
+
"@esbuild/linux-arm64": "0.19.10",
|
680 |
+
"@esbuild/linux-ia32": "0.19.10",
|
681 |
+
"@esbuild/linux-loong64": "0.19.10",
|
682 |
+
"@esbuild/linux-mips64el": "0.19.10",
|
683 |
+
"@esbuild/linux-ppc64": "0.19.10",
|
684 |
+
"@esbuild/linux-riscv64": "0.19.10",
|
685 |
+
"@esbuild/linux-s390x": "0.19.10",
|
686 |
+
"@esbuild/linux-x64": "0.19.10",
|
687 |
+
"@esbuild/netbsd-x64": "0.19.10",
|
688 |
+
"@esbuild/openbsd-x64": "0.19.10",
|
689 |
+
"@esbuild/sunos-x64": "0.19.10",
|
690 |
+
"@esbuild/win32-arm64": "0.19.10",
|
691 |
+
"@esbuild/win32-ia32": "0.19.10",
|
692 |
+
"@esbuild/win32-x64": "0.19.10"
|
693 |
+
}
|
694 |
+
},
|
695 |
+
"node_modules/estree-walker": {
|
696 |
+
"version": "3.0.3",
|
697 |
+
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
|
698 |
+
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
|
699 |
+
"peer": true,
|
700 |
+
"dependencies": {
|
701 |
+
"@types/estree": "^1.0.0"
|
702 |
+
}
|
703 |
+
},
|
704 |
+
"node_modules/event-emitter": {
|
705 |
+
"version": "0.3.5",
|
706 |
+
"resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
|
707 |
+
"integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
|
708 |
+
"dependencies": {
|
709 |
+
"d": "1",
|
710 |
+
"es5-ext": "~0.10.14"
|
711 |
+
}
|
712 |
+
},
|
713 |
+
"node_modules/ext": {
|
714 |
+
"version": "1.7.0",
|
715 |
+
"resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
|
716 |
+
"integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==",
|
717 |
+
"dependencies": {
|
718 |
+
"type": "^2.7.2"
|
719 |
+
}
|
720 |
+
},
|
721 |
+
"node_modules/ext/node_modules/type": {
|
722 |
+
"version": "2.7.2",
|
723 |
+
"resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
|
724 |
+
"integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
|
725 |
+
},
|
726 |
+
"node_modules/globalyzer": {
|
727 |
+
"version": "0.1.0",
|
728 |
+
"resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
|
729 |
+
"integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q=="
|
730 |
+
},
|
731 |
+
"node_modules/globrex": {
|
732 |
+
"version": "0.1.2",
|
733 |
+
"resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
|
734 |
+
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
|
735 |
+
},
|
736 |
+
"node_modules/intl-messageformat": {
|
737 |
+
"version": "9.13.0",
|
738 |
+
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz",
|
739 |
+
"integrity": "sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw==",
|
740 |
+
"dependencies": {
|
741 |
+
"@formatjs/ecma402-abstract": "1.11.4",
|
742 |
+
"@formatjs/fast-memoize": "1.2.1",
|
743 |
+
"@formatjs/icu-messageformat-parser": "2.1.0",
|
744 |
+
"tslib": "^2.1.0"
|
745 |
+
}
|
746 |
+
},
|
747 |
+
"node_modules/is-promise": {
|
748 |
+
"version": "2.2.2",
|
749 |
+
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
|
750 |
+
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
|
751 |
+
},
|
752 |
+
"node_modules/is-reference": {
|
753 |
+
"version": "3.0.2",
|
754 |
+
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz",
|
755 |
+
"integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==",
|
756 |
+
"peer": true,
|
757 |
+
"dependencies": {
|
758 |
+
"@types/estree": "*"
|
759 |
+
}
|
760 |
+
},
|
761 |
+
"node_modules/locate-character": {
|
762 |
+
"version": "3.0.0",
|
763 |
+
"resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
|
764 |
+
"integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
|
765 |
+
"peer": true
|
766 |
+
},
|
767 |
+
"node_modules/lru-queue": {
|
768 |
+
"version": "0.1.0",
|
769 |
+
"resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz",
|
770 |
+
"integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==",
|
771 |
+
"dependencies": {
|
772 |
+
"es5-ext": "~0.10.2"
|
773 |
+
}
|
774 |
+
},
|
775 |
+
"node_modules/magic-string": {
|
776 |
+
"version": "0.30.5",
|
777 |
+
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
|
778 |
+
"integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
|
779 |
+
"peer": true,
|
780 |
+
"dependencies": {
|
781 |
+
"@jridgewell/sourcemap-codec": "^1.4.15"
|
782 |
+
},
|
783 |
+
"engines": {
|
784 |
+
"node": ">=12"
|
785 |
+
}
|
786 |
+
},
|
787 |
+
"node_modules/mdn-data": {
|
788 |
+
"version": "2.0.30",
|
789 |
+
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
|
790 |
+
"integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",
|
791 |
+
"peer": true
|
792 |
+
},
|
793 |
+
"node_modules/memoizee": {
|
794 |
+
"version": "0.4.15",
|
795 |
+
"resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz",
|
796 |
+
"integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==",
|
797 |
+
"dependencies": {
|
798 |
+
"d": "^1.0.1",
|
799 |
+
"es5-ext": "^0.10.53",
|
800 |
+
"es6-weak-map": "^2.0.3",
|
801 |
+
"event-emitter": "^0.3.5",
|
802 |
+
"is-promise": "^2.2.2",
|
803 |
+
"lru-queue": "^0.1.0",
|
804 |
+
"next-tick": "^1.1.0",
|
805 |
+
"timers-ext": "^0.1.7"
|
806 |
+
}
|
807 |
+
},
|
808 |
+
"node_modules/mri": {
|
809 |
+
"version": "1.2.0",
|
810 |
+
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
811 |
+
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
812 |
+
"engines": {
|
813 |
+
"node": ">=4"
|
814 |
+
}
|
815 |
+
},
|
816 |
+
"node_modules/next-tick": {
|
817 |
+
"version": "1.1.0",
|
818 |
+
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
|
819 |
+
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
|
820 |
+
},
|
821 |
+
"node_modules/periscopic": {
|
822 |
+
"version": "3.1.0",
|
823 |
+
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz",
|
824 |
+
"integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==",
|
825 |
+
"peer": true,
|
826 |
+
"dependencies": {
|
827 |
+
"@types/estree": "^1.0.0",
|
828 |
+
"estree-walker": "^3.0.0",
|
829 |
+
"is-reference": "^3.0.0"
|
830 |
+
}
|
831 |
+
},
|
832 |
+
"node_modules/sade": {
|
833 |
+
"version": "1.8.1",
|
834 |
+
"resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
|
835 |
+
"integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==",
|
836 |
+
"dependencies": {
|
837 |
+
"mri": "^1.1.0"
|
838 |
+
},
|
839 |
+
"engines": {
|
840 |
+
"node": ">=6"
|
841 |
+
}
|
842 |
+
},
|
843 |
+
"node_modules/source-map-js": {
|
844 |
+
"version": "1.0.2",
|
845 |
+
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
846 |
+
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
847 |
+
"peer": true,
|
848 |
+
"engines": {
|
849 |
+
"node": ">=0.10.0"
|
850 |
+
}
|
851 |
+
},
|
852 |
+
"node_modules/svelte": {
|
853 |
+
"version": "4.2.8",
|
854 |
+
"resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.8.tgz",
|
855 |
+
"integrity": "sha512-hU6dh1MPl8gh6klQZwK/n73GiAHiR95IkFsesLPbMeEZi36ydaXL/ZAb4g9sayT0MXzpxyZjR28yderJHxcmYA==",
|
856 |
+
"peer": true,
|
857 |
+
"dependencies": {
|
858 |
+
"@ampproject/remapping": "^2.2.1",
|
859 |
+
"@jridgewell/sourcemap-codec": "^1.4.15",
|
860 |
+
"@jridgewell/trace-mapping": "^0.3.18",
|
861 |
+
"acorn": "^8.9.0",
|
862 |
+
"aria-query": "^5.3.0",
|
863 |
+
"axobject-query": "^3.2.1",
|
864 |
+
"code-red": "^1.0.3",
|
865 |
+
"css-tree": "^2.3.1",
|
866 |
+
"estree-walker": "^3.0.3",
|
867 |
+
"is-reference": "^3.0.1",
|
868 |
+
"locate-character": "^3.0.0",
|
869 |
+
"magic-string": "^0.30.4",
|
870 |
+
"periscopic": "^3.1.0"
|
871 |
+
},
|
872 |
+
"engines": {
|
873 |
+
"node": ">=16"
|
874 |
+
}
|
875 |
+
},
|
876 |
+
"node_modules/svelte-i18n": {
|
877 |
+
"version": "3.7.4",
|
878 |
+
"resolved": "https://registry.npmjs.org/svelte-i18n/-/svelte-i18n-3.7.4.tgz",
|
879 |
+
"integrity": "sha512-yGRCNo+eBT4cPuU7IVsYTYjxB7I2V8qgUZPlHnNctJj5IgbJgV78flsRzpjZ/8iUYZrS49oCt7uxlU3AZv/N5Q==",
|
880 |
+
"dependencies": {
|
881 |
+
"cli-color": "^2.0.3",
|
882 |
+
"deepmerge": "^4.2.2",
|
883 |
+
"esbuild": "^0.19.2",
|
884 |
+
"estree-walker": "^2",
|
885 |
+
"intl-messageformat": "^9.13.0",
|
886 |
+
"sade": "^1.8.1",
|
887 |
+
"tiny-glob": "^0.2.9"
|
888 |
+
},
|
889 |
+
"bin": {
|
890 |
+
"svelte-i18n": "dist/cli.js"
|
891 |
+
},
|
892 |
+
"engines": {
|
893 |
+
"node": ">= 16"
|
894 |
+
},
|
895 |
+
"peerDependencies": {
|
896 |
+
"svelte": "^3 || ^4"
|
897 |
+
}
|
898 |
+
},
|
899 |
+
"node_modules/svelte-i18n/node_modules/estree-walker": {
|
900 |
+
"version": "2.0.2",
|
901 |
+
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
902 |
+
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
|
903 |
+
},
|
904 |
+
"node_modules/timers-ext": {
|
905 |
+
"version": "0.1.7",
|
906 |
+
"resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz",
|
907 |
+
"integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==",
|
908 |
+
"dependencies": {
|
909 |
+
"es5-ext": "~0.10.46",
|
910 |
+
"next-tick": "1"
|
911 |
+
}
|
912 |
+
},
|
913 |
+
"node_modules/tiny-glob": {
|
914 |
+
"version": "0.2.9",
|
915 |
+
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
|
916 |
+
"integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
|
917 |
+
"dependencies": {
|
918 |
+
"globalyzer": "0.1.0",
|
919 |
+
"globrex": "^0.1.2"
|
920 |
+
}
|
921 |
+
},
|
922 |
+
"node_modules/tslib": {
|
923 |
+
"version": "2.6.2",
|
924 |
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
925 |
+
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
|
926 |
+
},
|
927 |
+
"node_modules/type": {
|
928 |
+
"version": "1.2.0",
|
929 |
+
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
|
930 |
+
"integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
|
931 |
+
}
|
932 |
+
}
|
933 |
+
}
|
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 = "iFrame components that wraps html and js code to make them interactive."
|
13 |
+
readme = "README.md"
|
14 |
+
license = "MIT"
|
15 |
+
requires-python = ">=3.8"
|
16 |
+
authors = [{ name = "YOUR NAME", email = "[email protected]" }]
|
17 |
+
keywords = ["gradio-custom-component", "gradio-template-HTML", "HTML", "iFrame"]
|
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", "backend/gradio_iframe/templates"]
|
40 |
+
|
41 |
+
[tool.hatch.build.targets.wheel]
|
42 |
+
packages = ["/backend/gradio_iframe"]
|
entrypoint.sh
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
#!/bin/bash
|
|
|
2 |
|
3 |
# installing all the dependencies
|
4 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
1 |
#!/bin/bash
|
2 |
+
# entrypoint script for the docker container to run at start
|
3 |
|
4 |
# installing all the dependencies
|
5 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
explanation/__init__.py
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# empty init file for the package
|
2 |
+
# for fastapi to recognize the module
|
explanation/interpret.py
CHANGED
@@ -1,40 +1,85 @@
|
|
1 |
-
|
|
|
2 |
import seaborn as sns
|
3 |
import matplotlib.pyplot as plt
|
|
|
|
|
4 |
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
values = shap_values[0]
|
8 |
input_text = shap_values.data[0]
|
9 |
output_text = shap_values.output_names
|
10 |
|
11 |
# Set the seaborn style for better aesthetics
|
12 |
-
sns.set(style="
|
13 |
plt.figure(figsize=(20, 10))
|
14 |
|
15 |
-
#
|
16 |
sns.heatmap(
|
17 |
-
|
18 |
cmap=color_palette,
|
19 |
center=0,
|
20 |
annot=False,
|
21 |
cbar_kws={"fraction": 0.02},
|
22 |
)
|
23 |
|
24 |
-
#
|
25 |
plt.xticks(
|
26 |
-
ticks=np.arange(len(
|
27 |
-
labels=
|
28 |
rotation=90,
|
29 |
)
|
30 |
plt.yticks(
|
31 |
-
ticks=np.arange(len(
|
32 |
-
labels=
|
33 |
rotation=0,
|
34 |
)
|
35 |
|
|
|
36 |
plt.xlabel("Output Tokens")
|
37 |
plt.ylabel("Input Tokens")
|
|
|
38 |
|
39 |
return plt
|
40 |
-
"""
|
|
|
1 |
+
# interpret module that implements the interpretability method
|
2 |
+
# external imports
|
3 |
import seaborn as sns
|
4 |
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
import shap
|
7 |
|
8 |
|
9 |
+
# main explain function that returns a chat with explanations
|
10 |
+
def chat_explained(model, prompt):
|
11 |
+
# create the shap explainer
|
12 |
+
shap_explainer = shap.PartitionExplainer(model.MODEL, model.TOKENIZER)
|
13 |
+
# get the shap values for the prompt
|
14 |
+
shap_values = shap_explainer(prompt)
|
15 |
+
|
16 |
+
# create the explanation graphic and plot
|
17 |
+
graphic = create_graphic(shap_values)
|
18 |
+
plot = create_plot(shap_values)
|
19 |
+
|
20 |
+
# create the response text
|
21 |
+
response_text = format_output_text(shap_values.output_names)
|
22 |
+
return response_text, graphic, plot
|
23 |
+
|
24 |
+
|
25 |
+
# output text formatting function that turns the list into a string
|
26 |
+
def format_output_text(output):
|
27 |
+
# start string with first list item
|
28 |
+
output_str = output[0]
|
29 |
+
# add all other list items with a space in between
|
30 |
+
for txt in output[1:]:
|
31 |
+
output_str += " " + txt
|
32 |
+
# return the output string
|
33 |
+
return output_str
|
34 |
+
|
35 |
+
|
36 |
+
# graphic plotting function that creates a html graphic (as string) for the explanation
|
37 |
+
def create_graphic(shap_values):
|
38 |
+
# create the html graphic using shap text plot function
|
39 |
+
graphic_html = shap.plots.text(shap_values, display=False)
|
40 |
+
|
41 |
+
# return the html graphic as string
|
42 |
+
return str(graphic_html)
|
43 |
+
|
44 |
+
|
45 |
+
# plotting function that creates a heatmap style explanation plot
|
46 |
+
def create_plot(shap_values):
|
47 |
+
# setup color palette for heatmap
|
48 |
+
color_palette = sns.color_palette("coolwarm", as_cmap=True)
|
49 |
+
|
50 |
+
# extract values, text from shap_values
|
51 |
values = shap_values[0]
|
52 |
input_text = shap_values.data[0]
|
53 |
output_text = shap_values.output_names
|
54 |
|
55 |
# Set the seaborn style for better aesthetics
|
56 |
+
sns.set(style="darkgrid")
|
57 |
plt.figure(figsize=(20, 10))
|
58 |
|
59 |
+
# create the heatmap with horizontal shape
|
60 |
sns.heatmap(
|
61 |
+
values,
|
62 |
cmap=color_palette,
|
63 |
center=0,
|
64 |
annot=False,
|
65 |
cbar_kws={"fraction": 0.02},
|
66 |
)
|
67 |
|
68 |
+
# adjusting labels and ticks
|
69 |
plt.xticks(
|
70 |
+
ticks=np.arange(len(output_text)) + 0.5,
|
71 |
+
labels=output_text,
|
72 |
rotation=90,
|
73 |
)
|
74 |
plt.yticks(
|
75 |
+
ticks=np.arange(len(input_text)) + 0.5,
|
76 |
+
labels=input_text,
|
77 |
rotation=0,
|
78 |
)
|
79 |
|
80 |
+
# set axis labels
|
81 |
plt.xlabel("Output Tokens")
|
82 |
plt.ylabel("Input Tokens")
|
83 |
+
plt.title("Token-wise SHAP Values")
|
84 |
|
85 |
return plt
|
|
explanation/visualize.py
CHANGED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# visualization module that creates an attention visualization using BERTViz
|
2 |
+
|
3 |
+
# external imports
|
4 |
+
from bertviz import head_view
|
5 |
+
|
6 |
+
|
7 |
+
# plotting function that plots the attention values in a heatmap
|
8 |
+
def chat_explained(model, prompt):
|
9 |
+
inputs = model.TOKENIZER(prompt, return_tensors="pt")
|
10 |
+
out = model.MODEL(**inputs, output_attentions=True)
|
11 |
+
|
12 |
+
attention = out["attentions"] # Retrieve attention from model outputs
|
13 |
+
tokens = model.TOKENIZER.convert_ids_to_tokens(
|
14 |
+
inputs["input_ids"][0]
|
15 |
+
) # Convert input ids to token strings
|
16 |
+
|
17 |
+
graphic = head_view(attention, tokens)
|
18 |
+
response_text = out[0]
|
19 |
+
plot = None
|
20 |
+
|
21 |
+
return response_text, graphic, plot
|
main.py
CHANGED
@@ -10,13 +10,12 @@ from backend.controller import interference
|
|
10 |
# Global Variables
|
11 |
app = FastAPI()
|
12 |
|
13 |
-
# different functions to provide frontend abilities
|
14 |
-
|
15 |
|
|
|
16 |
# function to load markdown files
|
17 |
def load_md(path):
|
18 |
-
#
|
19 |
-
|
20 |
with open(path, "r", encoding="utf-8") as file:
|
21 |
text = file.read()
|
22 |
return markdown.markdown(text)
|
@@ -24,11 +23,13 @@ def load_md(path):
|
|
24 |
|
25 |
# function to display the system prompt info
|
26 |
def system_prompt_info(sys_prompt_txt):
|
|
|
27 |
gr.Info(f"The system prompt was set to:\n {sys_prompt_txt}")
|
28 |
|
29 |
|
30 |
# function to display the xai info
|
31 |
def xai_info(xai_radio):
|
|
|
32 |
if xai_radio != "None":
|
33 |
gr.Info(f"The XAI was set to:\n {xai_radio}")
|
34 |
else:
|
@@ -37,6 +38,7 @@ def xai_info(xai_radio):
|
|
37 |
|
38 |
# function to display the model info
|
39 |
def model_info(model_radio):
|
|
|
40 |
gr.Info(f"The model was set to:\n {model_radio}")
|
41 |
|
42 |
|
@@ -45,6 +47,7 @@ def model_info(model_radio):
|
|
45 |
with gr.Blocks() as ui:
|
46 |
# header row with markdown based text
|
47 |
with gr.Row():
|
|
|
48 |
gr.Markdown(
|
49 |
"""
|
50 |
# Thesis Demo - AI Chat Application with XAI
|
@@ -54,6 +57,7 @@ with gr.Blocks() as ui:
|
|
54 |
# ChatBot tab used to chat with the AI chatbot
|
55 |
with gr.Tab("AI ChatBot"):
|
56 |
with gr.Row():
|
|
|
57 |
gr.Markdown(
|
58 |
"""
|
59 |
### ChatBot Demo
|
@@ -63,10 +67,11 @@ with gr.Blocks() as ui:
|
|
63 |
the system prompt and the XAI method.
|
64 |
"""
|
65 |
)
|
66 |
-
# row with
|
67 |
-
# the model at every turn
|
68 |
with gr.Row(equal_height=True):
|
|
|
69 |
with gr.Column(scale=3):
|
|
|
70 |
system_prompt = gr.Textbox(
|
71 |
label="System Prompt",
|
72 |
info="Set the models system prompt, dictating how it answers.",
|
@@ -76,8 +81,9 @@ with gr.Blocks() as ui:
|
|
76 |
),
|
77 |
)
|
78 |
with gr.Column(scale=1):
|
|
|
79 |
model = gr.Radio(
|
80 |
-
["Mistral", "
|
81 |
label="Model Selection",
|
82 |
info="Select Model to use for chat.",
|
83 |
value="Mistral",
|
@@ -85,6 +91,7 @@ with gr.Blocks() as ui:
|
|
85 |
show_label=True,
|
86 |
)
|
87 |
with gr.Column(scale=1):
|
|
|
88 |
xai = gr.Radio(
|
89 |
["None", "SHAP", "Visualizer"],
|
90 |
label="XAI Settings",
|
@@ -99,9 +106,10 @@ with gr.Blocks() as ui:
|
|
99 |
model.input(model_info, [model])
|
100 |
xai.input(xai_info, [xai])
|
101 |
|
102 |
-
# row with chatbot ui displaying "conversation" with the model
|
103 |
-
# documentation: https://www.gradio.app/docs/chatbot)
|
104 |
with gr.Row():
|
|
|
|
|
105 |
chatbot = gr.Chatbot(
|
106 |
layout="panel",
|
107 |
show_copy_button=True,
|
@@ -109,50 +117,86 @@ with gr.Blocks() as ui:
|
|
109 |
)
|
110 |
# row with input textbox
|
111 |
with gr.Row():
|
|
|
112 |
user_prompt = gr.Textbox(label="Input Message")
|
113 |
# row with columns for buttons to submit and clear content
|
114 |
with gr.Row():
|
115 |
with gr.Column(scale=1):
|
116 |
-
#
|
117 |
# documentation: https://www.gradio.app/docs/clearbutton)
|
118 |
clear_btn = gr.ClearButton([user_prompt, chatbot])
|
119 |
with gr.Column(scale=1):
|
120 |
submit_btn = gr.Button("Submit", variant="primary")
|
121 |
-
# function to trigger the model
|
122 |
-
# when button or the textbox submit function is used.
|
123 |
-
# hands over the information needed for the chat
|
124 |
-
# and information needed to call model and xai function
|
125 |
-
# returns prompt, history and xai
|
126 |
-
submit_btn.click(
|
127 |
-
interference,
|
128 |
-
[user_prompt, chatbot, system_prompt, model, xai],
|
129 |
-
[user_prompt, chatbot],
|
130 |
-
)
|
131 |
-
user_prompt.submit(
|
132 |
-
interference,
|
133 |
-
[user_prompt, chatbot, system_prompt, model, xai],
|
134 |
-
[user_prompt, chatbot],
|
135 |
-
)
|
136 |
|
137 |
# explanations tab used to provide explanations for a specific conversation
|
138 |
with gr.Tab("Explanations"):
|
|
|
139 |
with gr.Row():
|
140 |
gr.Markdown(
|
141 |
"""
|
142 |
### Get Explanations for Conversations
|
143 |
Using your selected XAI method, you can get explanations for
|
144 |
the conversation you had with the AI ChatBot. The explanations are
|
145 |
-
based on the last message you sent to the AI ChatBot
|
146 |
"""
|
147 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
with gr.Row():
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
with gr.Row():
|
151 |
-
with gr.Accordion("
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
#
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
with gr.Row():
|
157 |
with gr.Accordion("Credits, Data Protection and License", open=False):
|
158 |
gr.Markdown(value=load_md("public/credits_dataprotection_license.md"))
|
@@ -164,4 +208,6 @@ app = gr.mount_gradio_app(app, ui, path="/")
|
|
164 |
if __name__ == "__main__":
|
165 |
from uvicorn import run
|
166 |
|
|
|
|
|
167 |
run("main:app", port=8080, reload=True)
|
|
|
10 |
# Global Variables
|
11 |
app = FastAPI()
|
12 |
|
|
|
|
|
13 |
|
14 |
+
# different functions to provide frontend abilities
|
15 |
# function to load markdown files
|
16 |
def load_md(path):
|
17 |
+
# CREDIT: official python-markdown documentation
|
18 |
+
## see https://python-markdown.github.io/reference/)
|
19 |
with open(path, "r", encoding="utf-8") as file:
|
20 |
text = file.read()
|
21 |
return markdown.markdown(text)
|
|
|
23 |
|
24 |
# function to display the system prompt info
|
25 |
def system_prompt_info(sys_prompt_txt):
|
26 |
+
# display the system prompt using the Gradio Info component
|
27 |
gr.Info(f"The system prompt was set to:\n {sys_prompt_txt}")
|
28 |
|
29 |
|
30 |
# function to display the xai info
|
31 |
def xai_info(xai_radio):
|
32 |
+
# display the xai method using the Gradio Info component
|
33 |
if xai_radio != "None":
|
34 |
gr.Info(f"The XAI was set to:\n {xai_radio}")
|
35 |
else:
|
|
|
38 |
|
39 |
# function to display the model info
|
40 |
def model_info(model_radio):
|
41 |
+
# display the model using the Gradio Info component
|
42 |
gr.Info(f"The model was set to:\n {model_radio}")
|
43 |
|
44 |
|
|
|
47 |
with gr.Blocks() as ui:
|
48 |
# header row with markdown based text
|
49 |
with gr.Row():
|
50 |
+
# markdown component to display the header
|
51 |
gr.Markdown(
|
52 |
"""
|
53 |
# Thesis Demo - AI Chat Application with XAI
|
|
|
57 |
# ChatBot tab used to chat with the AI chatbot
|
58 |
with gr.Tab("AI ChatBot"):
|
59 |
with gr.Row():
|
60 |
+
# markdown component to display the header of the current tab
|
61 |
gr.Markdown(
|
62 |
"""
|
63 |
### ChatBot Demo
|
|
|
67 |
the system prompt and the XAI method.
|
68 |
"""
|
69 |
)
|
70 |
+
# row with columns for the different settings
|
|
|
71 |
with gr.Row(equal_height=True):
|
72 |
+
# column that takes up 3/5 of the row
|
73 |
with gr.Column(scale=3):
|
74 |
+
# textbox to enter the system prompt
|
75 |
system_prompt = gr.Textbox(
|
76 |
label="System Prompt",
|
77 |
info="Set the models system prompt, dictating how it answers.",
|
|
|
81 |
),
|
82 |
)
|
83 |
with gr.Column(scale=1):
|
84 |
+
# checkbox group to select the model
|
85 |
model = gr.Radio(
|
86 |
+
["Mistral", "GODEL"],
|
87 |
label="Model Selection",
|
88 |
info="Select Model to use for chat.",
|
89 |
value="Mistral",
|
|
|
91 |
show_label=True,
|
92 |
)
|
93 |
with gr.Column(scale=1):
|
94 |
+
# checkbox group to select the xai method
|
95 |
xai = gr.Radio(
|
96 |
["None", "SHAP", "Visualizer"],
|
97 |
label="XAI Settings",
|
|
|
106 |
model.input(model_info, [model])
|
107 |
xai.input(xai_info, [xai])
|
108 |
|
109 |
+
# row with chatbot ui displaying "conversation" with the model
|
|
|
110 |
with gr.Row():
|
111 |
+
# out of the box chatbot component
|
112 |
+
# see documentation: https://www.gradio.app/docs/chatbot
|
113 |
chatbot = gr.Chatbot(
|
114 |
layout="panel",
|
115 |
show_copy_button=True,
|
|
|
117 |
)
|
118 |
# row with input textbox
|
119 |
with gr.Row():
|
120 |
+
# textbox to enter the user prompt
|
121 |
user_prompt = gr.Textbox(label="Input Message")
|
122 |
# row with columns for buttons to submit and clear content
|
123 |
with gr.Row():
|
124 |
with gr.Column(scale=1):
|
125 |
+
# out of the box clear button which clearn the given components (see
|
126 |
# documentation: https://www.gradio.app/docs/clearbutton)
|
127 |
clear_btn = gr.ClearButton([user_prompt, chatbot])
|
128 |
with gr.Column(scale=1):
|
129 |
submit_btn = gr.Button("Submit", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
# explanations tab used to provide explanations for a specific conversation
|
132 |
with gr.Tab("Explanations"):
|
133 |
+
# row with markdown component to display the header of the current tab
|
134 |
with gr.Row():
|
135 |
gr.Markdown(
|
136 |
"""
|
137 |
### Get Explanations for Conversations
|
138 |
Using your selected XAI method, you can get explanations for
|
139 |
the conversation you had with the AI ChatBot. The explanations are
|
140 |
+
based on the last message you sent to the AI ChatBot (see text)
|
141 |
"""
|
142 |
)
|
143 |
+
# row that displays the settings used to create the current model output
|
144 |
+
## each textbox statically displays the current values
|
145 |
+
with gr.Row():
|
146 |
+
with gr.Column():
|
147 |
+
gr.Textbox(
|
148 |
+
value=xai,
|
149 |
+
label="Used XAI Variant",
|
150 |
+
show_label=True,
|
151 |
+
interactive=True,
|
152 |
+
)
|
153 |
+
with gr.Column():
|
154 |
+
gr.Textbox(
|
155 |
+
value=model, label="Used Model", show_label=True, interactive=True
|
156 |
+
)
|
157 |
+
with gr.Column():
|
158 |
+
gr.Textbox(
|
159 |
+
value=system_prompt,
|
160 |
+
label="Used System Prompt",
|
161 |
+
show_label=True,
|
162 |
+
interactive=True,
|
163 |
+
)
|
164 |
+
# row that displays the generated explanation of the model (if applicable)
|
165 |
with gr.Row():
|
166 |
+
# wraps the explanation html in an iframe to display it
|
167 |
+
xai_interactive = gr.HTML(
|
168 |
+
label="Interactive Explanation",
|
169 |
+
show_label=True,
|
170 |
+
value="<div><h1>No Graphic to Display</h1></div>",
|
171 |
+
)
|
172 |
+
# row and accordion to display an explanation plot (if applicable)
|
173 |
with gr.Row():
|
174 |
+
with gr.Accordion("Token Explanation Plot", open=False):
|
175 |
+
# plot component that takes a matplotlib figure as input
|
176 |
+
xai_plot = gr.Plot(
|
177 |
+
label="Token Level Explanation",
|
178 |
+
show_label=True,
|
179 |
+
every=5,
|
180 |
+
)
|
181 |
|
182 |
+
# functions to trigger the controller
|
183 |
+
## takes information for the chat and the model, xai selection
|
184 |
+
## returns prompt, history and xai data
|
185 |
+
## see backend/controller.py for more information
|
186 |
+
submit_btn.click(
|
187 |
+
interference,
|
188 |
+
[user_prompt, chatbot, system_prompt, model, xai],
|
189 |
+
[user_prompt, chatbot, xai_interactive, xai_plot],
|
190 |
+
)
|
191 |
+
# function triggered by the enter key
|
192 |
+
user_prompt.submit(
|
193 |
+
interference,
|
194 |
+
[user_prompt, chatbot, system_prompt, model, xai],
|
195 |
+
[user_prompt, chatbot, xai_interactive, xai_plot],
|
196 |
+
)
|
197 |
+
|
198 |
+
# final row to show legal information
|
199 |
+
## - credits, data protection and link to the License
|
200 |
with gr.Row():
|
201 |
with gr.Accordion("Credits, Data Protection and License", open=False):
|
202 |
gr.Markdown(value=load_md("public/credits_dataprotection_license.md"))
|
|
|
208 |
if __name__ == "__main__":
|
209 |
from uvicorn import run
|
210 |
|
211 |
+
# run the application on port 8080 in reload mode
|
212 |
+
## for local development, uses Docker for Prod deployment
|
213 |
run("main:app", port=8080, reload=True)
|
model/__init__.py
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# empty init file for the package
|
2 |
+
# for fastapi to recognize the module
|
model/godel.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# GODEL model module for chat interaction and model instance control
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
+
|
4 |
+
# model and tokenizer instance
|
5 |
+
TOKENIZER = AutoTokenizer.from_pretrained("microsoft/GODEL-v1_1-large-seq2seq")
|
6 |
+
MODEL = AutoModelForSeq2SeqLM.from_pretrained("microsoft/GODEL-v1_1-large-seq2seq")
|
7 |
+
GODEL_CONFIG = {"max_new_tokens": 50, "min_length": 8, "top_p": 0.9, "do_sample": True}
|
8 |
+
|
9 |
+
|
10 |
+
# formatting class to formatting input for the model
|
11 |
+
# CREDIT: Adapted from official interference example on Huggingface
|
12 |
+
## see https://huggingface.co/microsoft/GODEL-v1_1-large-seq2seq
|
13 |
+
def format_prompt(message: str, history: list, system_prompt: str, knowledge: str = ""):
|
14 |
+
prompt = ""
|
15 |
+
|
16 |
+
# adds knowledge text if not empty
|
17 |
+
if knowledge != "":
|
18 |
+
knowledge = "[KNOWLEDGE] " + knowledge
|
19 |
+
|
20 |
+
history.append([message])
|
21 |
+
for user_prompt, bot_response in history:
|
22 |
+
prompt += f"EOS {user_prompt} EOS {bot_response}"
|
23 |
+
|
24 |
+
prompt = f"{system_prompt} [CONTEXT] {prompt} {knowledge}"
|
25 |
+
|
26 |
+
# returns the full combined prompt for the model
|
27 |
+
return prompt
|
28 |
+
|
29 |
+
|
30 |
+
# response class calling the model and returning the model output message
|
31 |
+
# CREDIT: Copied from official interference example on Huggingface
|
32 |
+
## see https://huggingface.co/microsoft/GODEL-v1_1-large-seq2seq
|
33 |
+
def respond(prompt):
|
34 |
+
input_ids = TOKENIZER(f"{prompt}", return_tensors="pt").input_ids
|
35 |
+
outputs = MODEL.generate(input_ids, **GODEL_CONFIG)
|
36 |
+
output = TOKENIZER.decode(outputs[0], skip_special_tokens=True)
|
37 |
+
|
38 |
+
return output
|
model/llama2.py
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
TEMPERATURE = 0.7
|
2 |
-
MAX_NEW_TOKENS = 100
|
3 |
-
TOP_P = 0.95
|
4 |
-
REPETITION_PENALTY = 1.1
|
|
|
|
|
|
|
|
|
|
model/mistral.py
CHANGED
@@ -1,78 +1,71 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
#
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
prompt
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
return prompt
|
46 |
|
47 |
|
48 |
-
#
|
49 |
-
#
|
50 |
-
|
51 |
-
def respond(
|
52 |
-
|
53 |
-
|
54 |
-
# setting model temperature and
|
55 |
-
TEMPERATURE = float(TEMPERATURE)
|
56 |
-
TEMPERATURE = max(TEMPERATURE, 1e-2)
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
"temperature": TEMPERATURE,
|
63 |
-
"max_new_tokens": MAX_NEW_TOKENS,
|
64 |
-
"top_p": TOP_P,
|
65 |
-
"repetition_penalty": REPETITION_PENALTY,
|
66 |
-
"do_sample": True,
|
67 |
-
"seed": 42,
|
68 |
-
}
|
69 |
|
70 |
-
#
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
stream=False,
|
75 |
-
details=True,
|
76 |
-
return_full_text=False,
|
77 |
-
).generated_text
|
78 |
-
return output
|
|
|
1 |
+
# Mistral 7B model module for chat interaction and model instance control
|
2 |
+
|
3 |
+
# external imports
|
4 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
5 |
+
import torch
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
+
# global variables for model and tokenizer, config
|
9 |
+
MODEL = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
10 |
+
TOKENIZER = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
|
11 |
+
MISTRAL_CONFIG = GenerationConfig.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
|
12 |
+
|
13 |
+
MISTRAL_CONFIG.update(
|
14 |
+
**{
|
15 |
+
"temperature": 0.7,
|
16 |
+
"max_new_tokens": 50,
|
17 |
+
"top_p": 0.9,
|
18 |
+
"repetition_penalty": 1.2,
|
19 |
+
"do_sample": True,
|
20 |
+
"seed": 42,
|
21 |
+
}
|
22 |
+
)
|
23 |
+
|
24 |
+
|
25 |
+
# function to format the prompt to include chat history, message
|
26 |
+
# CREDIT: adapted from Venkata Bhanu Teja Pallakonda in Huggingface discussions
|
27 |
+
## see https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1/discussions/
|
28 |
+
|
29 |
+
|
30 |
+
def format_prompt(message: str, history: list, system_prompt: str, knowledge: str = ""):
|
31 |
+
prompt = ""
|
32 |
+
if knowledge != "":
|
33 |
+
gr.Warning(
|
34 |
+
"""Mistral does not support
|
35 |
+
additionally knowledge!"""
|
36 |
+
)
|
37 |
+
|
38 |
+
# if no history, use system prompt and example message
|
39 |
+
if len(history) == 0:
|
40 |
+
prompt = f"""<s>[INST] {system_prompt} [/INST] How can I help you today? </s>
|
41 |
+
[INST] {message} [/INST]"""
|
42 |
+
else:
|
43 |
+
# takes the very first exchange and the system prompt as base
|
44 |
+
for user_prompt, bot_response in history[0]:
|
45 |
+
prompt = (
|
46 |
+
f"<s>[INST] {system_prompt} {user_prompt} [/INST] {bot_response}</s>"
|
47 |
+
)
|
48 |
+
|
49 |
+
# takes all the following conversations and adds them as context
|
50 |
+
prompt += "".join(
|
51 |
+
f"[INST] {user_prompt} [/INST] {bot_response}</s>"
|
52 |
+
for user_prompt, bot_response in history[1:]
|
53 |
+
)
|
54 |
return prompt
|
55 |
|
56 |
|
57 |
+
# generation class returning the model response based on the input
|
58 |
+
# CREDIT: adapted from official Mistral Ai 7B Instruct documentation on Huggingface
|
59 |
+
## see https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1
|
60 |
+
def respond(prompt):
|
61 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
# tokenizing inputs and configuring model
|
64 |
+
input_ids = TOKENIZER(f"{prompt}", return_tensors="pt")
|
65 |
+
model_input = input_ids.to(device)
|
66 |
+
MODEL.to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
# generating text with tokenized input, returning output
|
69 |
+
output_ids = MODEL.generate(model_input, generation_config=MISTRAL_CONFIG)
|
70 |
+
output_text = TOKENIZER.batch_decode(output_ids)
|
71 |
+
return output_text[0]
|
|
|
|
|
|
|
|
|
|
pyproject.toml
CHANGED
@@ -13,6 +13,7 @@ exclude = '''
|
|
13 |
| buck-out
|
14 |
| build
|
15 |
| dist
|
|
|
16 |
)/
|
17 |
'''
|
18 |
|
@@ -53,3 +54,6 @@ disable = [
|
|
53 |
|
54 |
[tool.pylint.format]
|
55 |
max-line-length = "88"
|
|
|
|
|
|
|
|
13 |
| buck-out
|
14 |
| build
|
15 |
| dist
|
16 |
+
| components
|
17 |
)/
|
18 |
'''
|
19 |
|
|
|
54 |
|
55 |
[tool.pylint.format]
|
56 |
max-line-length = "88"
|
57 |
+
|
58 |
+
[tool.pylint.MASTER]
|
59 |
+
ignore = "components"
|
requirements.txt
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
gradio~=4.7.1
|
2 |
transformers~=4.35.2
|
3 |
torch~=2.1.1
|
4 |
-
shap~=0.
|
|
|
5 |
accelerate~=0.24.1
|
6 |
markdown~=3.5.1
|
7 |
huggingface_hub~=0.19.4
|
@@ -10,4 +11,8 @@ uvicorn~=0.24.0
|
|
10 |
tinydb~=4.8.0
|
11 |
black~=23.12.0
|
12 |
pylint~=3.0.0
|
|
|
|
|
|
|
13 |
pre-commit
|
|
|
|
1 |
gradio~=4.7.1
|
2 |
transformers~=4.35.2
|
3 |
torch~=2.1.1
|
4 |
+
shap~=0.44.0
|
5 |
+
bertviz~=1.4.0
|
6 |
accelerate~=0.24.1
|
7 |
markdown~=3.5.1
|
8 |
huggingface_hub~=0.19.4
|
|
|
11 |
tinydb~=4.8.0
|
12 |
black~=23.12.0
|
13 |
pylint~=3.0.0
|
14 |
+
seaborn~=0.13.0
|
15 |
+
numpy
|
16 |
+
matplotlib
|
17 |
pre-commit
|
18 |
+
#./components/iframe/dist/gradio_iframe-0.0.1-py3-none-any.whl
|