Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/events.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/pipelines.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/pipelines_utils.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/route_utils.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/templates.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/utils.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/annotatedimage/Index.svelte +295 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/annotatedimage/package.json +38 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/atoms/package.json +33 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/box/Index.svelte +10 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/box/package.json +29 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkbox/package.json +40 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkboxgroup/Index.svelte +179 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkboxgroup/package.json +40 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/Example.svelte +19 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/Index.svelte +99 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/Code.svelte +268 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/Widgets.svelte +13 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/extensions.ts +48 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/frontmatter.ts +61 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/language.ts +117 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/Index.svelte +81 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/package.json +36 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/shared/JSON.svelte +99 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/shared/JSONNode.svelte +273 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/multimodaltextbox/Index.svelte +113 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/multimodaltextbox/shared/utils.ts +60 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/Example.svelte +19 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/Index.svelte +17 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/ParamViewer.svelte +259 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/package.json +41 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/prism.css +211 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/Index.svelte +30 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/package.json +34 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/shared/TabItem.svelte +52 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/accordion.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/form.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/tabs.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/accordion.py +51 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/column.py +71 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/column.pyi +76 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/form.py +52 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/group.py +43 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/row.py +77 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/row.pyi +82 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/tabs.pyi +246 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Example.Ce2XkglX.js.gz +3 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Gallery.HXgWnEV3.js.gz +3 -0
- evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/IconButtonWrapper.y99hkeYc.js.gz +3 -0
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/events.cpython-310.pyc
ADDED
|
Binary file (36.5 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/pipelines.cpython-310.pyc
ADDED
|
Binary file (3.2 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/pipelines_utils.cpython-310.pyc
ADDED
|
Binary file (20.1 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/route_utils.cpython-310.pyc
ADDED
|
Binary file (30.5 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/templates.cpython-310.pyc
ADDED
|
Binary file (16 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (50.1 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/annotatedimage/Index.svelte
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import type { Gradio, SelectData } from "@gradio/utils";
|
| 3 |
+
|
| 4 |
+
import { onMount } from "svelte";
|
| 5 |
+
import {
|
| 6 |
+
Block,
|
| 7 |
+
BlockLabel,
|
| 8 |
+
Empty,
|
| 9 |
+
IconButton,
|
| 10 |
+
IconButtonWrapper
|
| 11 |
+
} from "@gradio/atoms";
|
| 12 |
+
import { Image, Maximize, Minimize } from "@gradio/icons";
|
| 13 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 14 |
+
import type { LoadingStatus } from "@gradio/statustracker";
|
| 15 |
+
import { type FileData } from "@gradio/client";
|
| 16 |
+
import { resolve_wasm_src } from "@gradio/wasm/svelte";
|
| 17 |
+
|
| 18 |
+
export let elem_id = "";
|
| 19 |
+
export let elem_classes: string[] = [];
|
| 20 |
+
export let visible = true;
|
| 21 |
+
export let value: {
|
| 22 |
+
image: FileData;
|
| 23 |
+
annotations: { image: FileData; label: string }[] | [];
|
| 24 |
+
} | null = null;
|
| 25 |
+
let old_value: {
|
| 26 |
+
image: FileData;
|
| 27 |
+
annotations: { image: FileData; label: string }[] | [];
|
| 28 |
+
} | null = null;
|
| 29 |
+
let _value: {
|
| 30 |
+
image: FileData;
|
| 31 |
+
annotations: { image: FileData; label: string }[];
|
| 32 |
+
} | null = null;
|
| 33 |
+
export let gradio: Gradio<{
|
| 34 |
+
change: undefined;
|
| 35 |
+
select: SelectData;
|
| 36 |
+
}>;
|
| 37 |
+
export let label = gradio.i18n("annotated_image.annotated_image");
|
| 38 |
+
export let show_label = true;
|
| 39 |
+
export let show_legend = true;
|
| 40 |
+
export let height: number | undefined;
|
| 41 |
+
export let width: number | undefined;
|
| 42 |
+
export let color_map: Record<string, string>;
|
| 43 |
+
export let container = true;
|
| 44 |
+
export let scale: number | null = null;
|
| 45 |
+
export let min_width: number | undefined = undefined;
|
| 46 |
+
let active: string | null = null;
|
| 47 |
+
export let loading_status: LoadingStatus;
|
| 48 |
+
export let show_fullscreen_button = true;
|
| 49 |
+
|
| 50 |
+
let is_full_screen = false;
|
| 51 |
+
let image_container: HTMLElement;
|
| 52 |
+
|
| 53 |
+
onMount(() => {
|
| 54 |
+
document.addEventListener("fullscreenchange", () => {
|
| 55 |
+
is_full_screen = !!document.fullscreenElement;
|
| 56 |
+
});
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
const toggle_full_screen = async (): Promise<void> => {
|
| 60 |
+
if (!is_full_screen) {
|
| 61 |
+
await image_container.requestFullscreen();
|
| 62 |
+
} else {
|
| 63 |
+
await document.exitFullscreen();
|
| 64 |
+
}
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
// `value` can be updated before the Promises from `resolve_wasm_src` are resolved.
|
| 68 |
+
// In such a case, the resolved values for the old `value` have to be discarded,
|
| 69 |
+
// This variable `latest_promise` is used to pick up only the values resolved for the latest `value`.
|
| 70 |
+
let latest_promise: Promise<unknown> | null = null;
|
| 71 |
+
$: {
|
| 72 |
+
if (value !== old_value) {
|
| 73 |
+
old_value = value;
|
| 74 |
+
gradio.dispatch("change");
|
| 75 |
+
}
|
| 76 |
+
if (value) {
|
| 77 |
+
const normalized_value = {
|
| 78 |
+
image: value.image as FileData,
|
| 79 |
+
annotations: value.annotations.map((ann) => ({
|
| 80 |
+
image: ann.image as FileData,
|
| 81 |
+
label: ann.label
|
| 82 |
+
}))
|
| 83 |
+
};
|
| 84 |
+
_value = normalized_value;
|
| 85 |
+
|
| 86 |
+
// In normal (non-Wasm) Gradio, the `<img>` element should be rendered with the passed values immediately
|
| 87 |
+
// without waiting for `resolve_wasm_src()` to resolve.
|
| 88 |
+
// If it waits, a blank image is displayed until the async task finishes
|
| 89 |
+
// and it leads to undesirable flickering.
|
| 90 |
+
// So set `_value` immediately above, and update it with the resolved values below later.
|
| 91 |
+
const image_url_promise = resolve_wasm_src(normalized_value.image.url);
|
| 92 |
+
const annotation_urls_promise = Promise.all(
|
| 93 |
+
normalized_value.annotations.map((ann) =>
|
| 94 |
+
resolve_wasm_src(ann.image.url)
|
| 95 |
+
)
|
| 96 |
+
);
|
| 97 |
+
const current_promise = Promise.all([
|
| 98 |
+
image_url_promise,
|
| 99 |
+
annotation_urls_promise
|
| 100 |
+
]);
|
| 101 |
+
latest_promise = current_promise;
|
| 102 |
+
current_promise.then(([image_url, annotation_urls]) => {
|
| 103 |
+
if (latest_promise !== current_promise) {
|
| 104 |
+
return;
|
| 105 |
+
}
|
| 106 |
+
const async_resolved_value: typeof _value = {
|
| 107 |
+
image: {
|
| 108 |
+
...normalized_value.image,
|
| 109 |
+
url: image_url ?? undefined
|
| 110 |
+
},
|
| 111 |
+
annotations: normalized_value.annotations.map((ann, i) => ({
|
| 112 |
+
...ann,
|
| 113 |
+
image: {
|
| 114 |
+
...ann.image,
|
| 115 |
+
url: annotation_urls[i] ?? undefined
|
| 116 |
+
}
|
| 117 |
+
}))
|
| 118 |
+
};
|
| 119 |
+
_value = async_resolved_value;
|
| 120 |
+
});
|
| 121 |
+
} else {
|
| 122 |
+
_value = null;
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
function handle_mouseover(_label: string): void {
|
| 126 |
+
active = _label;
|
| 127 |
+
}
|
| 128 |
+
function handle_mouseout(): void {
|
| 129 |
+
active = null;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
function handle_click(i: number, value: string): void {
|
| 133 |
+
gradio.dispatch("select", {
|
| 134 |
+
value: label,
|
| 135 |
+
index: i
|
| 136 |
+
});
|
| 137 |
+
}
|
| 138 |
+
</script>
|
| 139 |
+
|
| 140 |
+
<Block
|
| 141 |
+
{visible}
|
| 142 |
+
{elem_id}
|
| 143 |
+
{elem_classes}
|
| 144 |
+
padding={false}
|
| 145 |
+
{height}
|
| 146 |
+
{width}
|
| 147 |
+
allow_overflow={false}
|
| 148 |
+
{container}
|
| 149 |
+
{scale}
|
| 150 |
+
{min_width}
|
| 151 |
+
>
|
| 152 |
+
<StatusTracker
|
| 153 |
+
autoscroll={gradio.autoscroll}
|
| 154 |
+
i18n={gradio.i18n}
|
| 155 |
+
{...loading_status}
|
| 156 |
+
/>
|
| 157 |
+
<BlockLabel
|
| 158 |
+
{show_label}
|
| 159 |
+
Icon={Image}
|
| 160 |
+
label={label || gradio.i18n("image.image")}
|
| 161 |
+
/>
|
| 162 |
+
|
| 163 |
+
<div class="container">
|
| 164 |
+
{#if _value == null}
|
| 165 |
+
<Empty size="large" unpadded_box={true}><Image /></Empty>
|
| 166 |
+
{:else}
|
| 167 |
+
<div class="image-container" bind:this={image_container}>
|
| 168 |
+
<IconButtonWrapper>
|
| 169 |
+
{#if !is_full_screen && show_fullscreen_button}
|
| 170 |
+
<IconButton
|
| 171 |
+
Icon={Maximize}
|
| 172 |
+
label="View in full screen"
|
| 173 |
+
on:click={toggle_full_screen}
|
| 174 |
+
/>
|
| 175 |
+
{/if}
|
| 176 |
+
|
| 177 |
+
{#if is_full_screen}
|
| 178 |
+
<IconButton
|
| 179 |
+
Icon={Minimize}
|
| 180 |
+
label="Exit full screen"
|
| 181 |
+
on:click={toggle_full_screen}
|
| 182 |
+
/>
|
| 183 |
+
{/if}
|
| 184 |
+
</IconButtonWrapper>
|
| 185 |
+
|
| 186 |
+
<img
|
| 187 |
+
class="base-image"
|
| 188 |
+
class:fit-height={height && !is_full_screen}
|
| 189 |
+
src={_value ? _value.image.url : null}
|
| 190 |
+
alt="the base file that is annotated"
|
| 191 |
+
/>
|
| 192 |
+
{#each _value ? _value?.annotations : [] as ann, i}
|
| 193 |
+
<img
|
| 194 |
+
alt="segmentation mask identifying {label} within the uploaded file"
|
| 195 |
+
class="mask fit-height"
|
| 196 |
+
class:fit-height={!is_full_screen}
|
| 197 |
+
class:active={active == ann.label}
|
| 198 |
+
class:inactive={active != ann.label && active != null}
|
| 199 |
+
src={ann.image.url}
|
| 200 |
+
style={color_map && ann.label in color_map
|
| 201 |
+
? null
|
| 202 |
+
: `filter: hue-rotate(${Math.round(
|
| 203 |
+
(i * 360) / _value?.annotations.length
|
| 204 |
+
)}deg);`}
|
| 205 |
+
/>
|
| 206 |
+
{/each}
|
| 207 |
+
</div>
|
| 208 |
+
{#if show_legend && _value}
|
| 209 |
+
<div class="legend">
|
| 210 |
+
{#each _value.annotations as ann, i}
|
| 211 |
+
<button
|
| 212 |
+
class="legend-item"
|
| 213 |
+
style="background-color: {color_map && ann.label in color_map
|
| 214 |
+
? color_map[ann.label] + '88'
|
| 215 |
+
: `hsla(${Math.round(
|
| 216 |
+
(i * 360) / _value.annotations.length
|
| 217 |
+
)}, 100%, 50%, 0.3)`}"
|
| 218 |
+
on:mouseover={() => handle_mouseover(ann.label)}
|
| 219 |
+
on:focus={() => handle_mouseover(ann.label)}
|
| 220 |
+
on:mouseout={() => handle_mouseout()}
|
| 221 |
+
on:blur={() => handle_mouseout()}
|
| 222 |
+
on:click={() => handle_click(i, ann.label)}
|
| 223 |
+
>
|
| 224 |
+
{ann.label}
|
| 225 |
+
</button>
|
| 226 |
+
{/each}
|
| 227 |
+
</div>
|
| 228 |
+
{/if}
|
| 229 |
+
{/if}
|
| 230 |
+
</div>
|
| 231 |
+
</Block>
|
| 232 |
+
|
| 233 |
+
<style>
|
| 234 |
+
.base-image {
|
| 235 |
+
display: block;
|
| 236 |
+
width: 100%;
|
| 237 |
+
height: auto;
|
| 238 |
+
}
|
| 239 |
+
.container {
|
| 240 |
+
display: flex;
|
| 241 |
+
position: relative;
|
| 242 |
+
flex-direction: column;
|
| 243 |
+
justify-content: center;
|
| 244 |
+
align-items: center;
|
| 245 |
+
width: var(--size-full);
|
| 246 |
+
height: var(--size-full);
|
| 247 |
+
}
|
| 248 |
+
.image-container {
|
| 249 |
+
position: relative;
|
| 250 |
+
top: 0;
|
| 251 |
+
left: 0;
|
| 252 |
+
flex-grow: 1;
|
| 253 |
+
width: 100%;
|
| 254 |
+
overflow: hidden;
|
| 255 |
+
}
|
| 256 |
+
.fit-height {
|
| 257 |
+
top: 0;
|
| 258 |
+
left: 0;
|
| 259 |
+
width: 100%;
|
| 260 |
+
height: 100%;
|
| 261 |
+
object-fit: contain;
|
| 262 |
+
}
|
| 263 |
+
.mask {
|
| 264 |
+
opacity: 0.85;
|
| 265 |
+
transition: all 0.2s ease-in-out;
|
| 266 |
+
position: absolute;
|
| 267 |
+
}
|
| 268 |
+
.image-container:hover .mask {
|
| 269 |
+
opacity: 0.3;
|
| 270 |
+
}
|
| 271 |
+
.mask.active {
|
| 272 |
+
opacity: 1;
|
| 273 |
+
}
|
| 274 |
+
.mask.inactive {
|
| 275 |
+
opacity: 0;
|
| 276 |
+
}
|
| 277 |
+
.legend {
|
| 278 |
+
display: flex;
|
| 279 |
+
flex-direction: row;
|
| 280 |
+
flex-wrap: wrap;
|
| 281 |
+
align-content: center;
|
| 282 |
+
justify-content: center;
|
| 283 |
+
align-items: center;
|
| 284 |
+
gap: var(--spacing-sm);
|
| 285 |
+
padding: var(--spacing-sm);
|
| 286 |
+
}
|
| 287 |
+
.legend-item {
|
| 288 |
+
display: flex;
|
| 289 |
+
flex-direction: row;
|
| 290 |
+
align-items: center;
|
| 291 |
+
cursor: pointer;
|
| 292 |
+
border-radius: var(--radius-sm);
|
| 293 |
+
padding: var(--spacing-sm);
|
| 294 |
+
}
|
| 295 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/annotatedimage/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/annotatedimage",
|
| 3 |
+
"version": "0.8.2",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"exports": {
|
| 11 |
+
".": {
|
| 12 |
+
"gradio": "./Index.svelte",
|
| 13 |
+
"svelte": "./dist/Index.svelte",
|
| 14 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 15 |
+
},
|
| 16 |
+
"./package.json": "./package.json"
|
| 17 |
+
},
|
| 18 |
+
"devDependencies": {
|
| 19 |
+
"@gradio/preview": "workspace:^"
|
| 20 |
+
},
|
| 21 |
+
"peerDependencies": {
|
| 22 |
+
"svelte": "^4.0.0"
|
| 23 |
+
},
|
| 24 |
+
"dependencies": {
|
| 25 |
+
"@gradio/atoms": "workspace:^",
|
| 26 |
+
"@gradio/icons": "workspace:^",
|
| 27 |
+
"@gradio/statustracker": "workspace:^",
|
| 28 |
+
"@gradio/upload": "workspace:^",
|
| 29 |
+
"@gradio/utils": "workspace:^",
|
| 30 |
+
"@gradio/client": "workspace:^",
|
| 31 |
+
"@gradio/wasm": "workspace:^"
|
| 32 |
+
},
|
| 33 |
+
"repository": {
|
| 34 |
+
"type": "git",
|
| 35 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 36 |
+
"directory": "js/annotatedimage"
|
| 37 |
+
}
|
| 38 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/atoms/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/atoms",
|
| 3 |
+
"version": "0.9.0",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"main": "src/index.ts",
|
| 7 |
+
"author": "",
|
| 8 |
+
"license": "ISC",
|
| 9 |
+
"dependencies": {
|
| 10 |
+
"@gradio/icons": "workspace:^",
|
| 11 |
+
"@gradio/utils": "workspace:^"
|
| 12 |
+
},
|
| 13 |
+
"peerDependencies": {
|
| 14 |
+
"svelte": "^4.0.0"
|
| 15 |
+
},
|
| 16 |
+
"exports": {
|
| 17 |
+
".": {
|
| 18 |
+
"gradio": "./src/index.ts",
|
| 19 |
+
"svelte": "./dist/src/index.js",
|
| 20 |
+
"types": "./dist/src/index.d.ts"
|
| 21 |
+
},
|
| 22 |
+
"./package.json": "./package.json"
|
| 23 |
+
},
|
| 24 |
+
"main_changeset": true,
|
| 25 |
+
"repository": {
|
| 26 |
+
"type": "git",
|
| 27 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 28 |
+
"directory": "js/atoms"
|
| 29 |
+
},
|
| 30 |
+
"scripts": {
|
| 31 |
+
"sv-pkg": "svelte-package --input=. --cwd=../../.config/"
|
| 32 |
+
}
|
| 33 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/box/Index.svelte
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { Block } from "@gradio/atoms";
|
| 3 |
+
export let elem_id: string;
|
| 4 |
+
export let elem_classes: string[];
|
| 5 |
+
export let visible = true;
|
| 6 |
+
</script>
|
| 7 |
+
|
| 8 |
+
<Block {elem_id} {elem_classes} {visible} explicit_call>
|
| 9 |
+
<slot />
|
| 10 |
+
</Block>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/box/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/box",
|
| 3 |
+
"version": "0.2.0",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"exports": {
|
| 11 |
+
".": {
|
| 12 |
+
"gradio": "./Index.svelte",
|
| 13 |
+
"svelte": "./dist/Index.svelte",
|
| 14 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 15 |
+
},
|
| 16 |
+
"./package.json": "./package.json"
|
| 17 |
+
},
|
| 18 |
+
"dependencies": {
|
| 19 |
+
"@gradio/atoms": "workspace:^"
|
| 20 |
+
},
|
| 21 |
+
"peerDependencies": {
|
| 22 |
+
"svelte": "^4.0.0"
|
| 23 |
+
},
|
| 24 |
+
"repository": {
|
| 25 |
+
"type": "git",
|
| 26 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 27 |
+
"directory": "js/box"
|
| 28 |
+
}
|
| 29 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkbox/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/checkbox",
|
| 3 |
+
"version": "0.4.1",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"main": "./Index.svelte",
|
| 11 |
+
"exports": {
|
| 12 |
+
"./package.json": "./package.json",
|
| 13 |
+
".": {
|
| 14 |
+
"gradio": "./Index.svelte",
|
| 15 |
+
"svelte": "./dist/Index.svelte",
|
| 16 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 17 |
+
},
|
| 18 |
+
"./example": {
|
| 19 |
+
"gradio": "./Example.svelte",
|
| 20 |
+
"svelte": "./dist/Example.svelte",
|
| 21 |
+
"types": "./dist/Example.svelte.d.ts"
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"dependencies": {
|
| 25 |
+
"@gradio/atoms": "workspace:^",
|
| 26 |
+
"@gradio/statustracker": "workspace:^",
|
| 27 |
+
"@gradio/utils": "workspace:^"
|
| 28 |
+
},
|
| 29 |
+
"devDependencies": {
|
| 30 |
+
"@gradio/preview": "workspace:^"
|
| 31 |
+
},
|
| 32 |
+
"peerDependencies": {
|
| 33 |
+
"svelte": "^4.0.0"
|
| 34 |
+
},
|
| 35 |
+
"repository": {
|
| 36 |
+
"type": "git",
|
| 37 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 38 |
+
"directory": "js/checkbox"
|
| 39 |
+
}
|
| 40 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkboxgroup/Index.svelte
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<svelte:options immutable={true} />
|
| 2 |
+
|
| 3 |
+
<script lang="ts">
|
| 4 |
+
import type { Gradio, SelectData } from "@gradio/utils";
|
| 5 |
+
import { Block, BlockTitle } from "@gradio/atoms";
|
| 6 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 7 |
+
import type { LoadingStatus } from "@gradio/statustracker";
|
| 8 |
+
|
| 9 |
+
export let gradio: Gradio<{
|
| 10 |
+
change: never;
|
| 11 |
+
select: SelectData;
|
| 12 |
+
input: never;
|
| 13 |
+
clear_status: LoadingStatus;
|
| 14 |
+
}>;
|
| 15 |
+
export let elem_id = "";
|
| 16 |
+
export let elem_classes: string[] = [];
|
| 17 |
+
export let visible = true;
|
| 18 |
+
export let value: (string | number)[] = [];
|
| 19 |
+
export let choices: [string, string | number][];
|
| 20 |
+
export let container = true;
|
| 21 |
+
export let scale: number | null = null;
|
| 22 |
+
export let min_width: number | undefined = undefined;
|
| 23 |
+
export let label = gradio.i18n("checkbox.checkbox_group");
|
| 24 |
+
export let info: string | undefined = undefined;
|
| 25 |
+
export let show_label = true;
|
| 26 |
+
export let root: string;
|
| 27 |
+
|
| 28 |
+
export let loading_status: LoadingStatus;
|
| 29 |
+
export let interactive = true;
|
| 30 |
+
export let old_value = value.slice();
|
| 31 |
+
|
| 32 |
+
function toggle_choice(choice: string | number): void {
|
| 33 |
+
if (value.includes(choice)) {
|
| 34 |
+
value = value.filter((v) => v !== choice);
|
| 35 |
+
} else {
|
| 36 |
+
value = [...value, choice];
|
| 37 |
+
}
|
| 38 |
+
gradio.dispatch("input");
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$: disabled = !interactive;
|
| 42 |
+
|
| 43 |
+
$: if (JSON.stringify(old_value) !== JSON.stringify(value)) {
|
| 44 |
+
old_value = value;
|
| 45 |
+
gradio.dispatch("change");
|
| 46 |
+
}
|
| 47 |
+
</script>
|
| 48 |
+
|
| 49 |
+
<Block
|
| 50 |
+
{visible}
|
| 51 |
+
{elem_id}
|
| 52 |
+
{elem_classes}
|
| 53 |
+
type="fieldset"
|
| 54 |
+
{container}
|
| 55 |
+
{scale}
|
| 56 |
+
{min_width}
|
| 57 |
+
>
|
| 58 |
+
<StatusTracker
|
| 59 |
+
autoscroll={gradio.autoscroll}
|
| 60 |
+
i18n={gradio.i18n}
|
| 61 |
+
{...loading_status}
|
| 62 |
+
on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
|
| 63 |
+
/>
|
| 64 |
+
<BlockTitle {root} {show_label} {info}>{label}</BlockTitle>
|
| 65 |
+
|
| 66 |
+
<div class="wrap" data-testid="checkbox-group">
|
| 67 |
+
{#each choices as [display_value, internal_value], i}
|
| 68 |
+
<label class:disabled class:selected={value.includes(internal_value)}>
|
| 69 |
+
<input
|
| 70 |
+
{disabled}
|
| 71 |
+
on:change={() => toggle_choice(internal_value)}
|
| 72 |
+
on:input={(evt) =>
|
| 73 |
+
gradio.dispatch("select", {
|
| 74 |
+
index: i,
|
| 75 |
+
value: internal_value,
|
| 76 |
+
selected: evt.currentTarget.checked
|
| 77 |
+
})}
|
| 78 |
+
on:keydown={(event) => {
|
| 79 |
+
if (event.key === "Enter") {
|
| 80 |
+
toggle_choice(internal_value);
|
| 81 |
+
gradio.dispatch("select", {
|
| 82 |
+
index: i,
|
| 83 |
+
value: internal_value,
|
| 84 |
+
selected: !value.includes(internal_value)
|
| 85 |
+
});
|
| 86 |
+
}
|
| 87 |
+
}}
|
| 88 |
+
checked={value.includes(internal_value)}
|
| 89 |
+
type="checkbox"
|
| 90 |
+
name={internal_value?.toString()}
|
| 91 |
+
title={internal_value?.toString()}
|
| 92 |
+
/>
|
| 93 |
+
<span class="ml-2">{display_value}</span>
|
| 94 |
+
</label>
|
| 95 |
+
{/each}
|
| 96 |
+
</div>
|
| 97 |
+
</Block>
|
| 98 |
+
|
| 99 |
+
<style>
|
| 100 |
+
.wrap {
|
| 101 |
+
display: flex;
|
| 102 |
+
flex-wrap: wrap;
|
| 103 |
+
gap: var(--checkbox-label-gap);
|
| 104 |
+
}
|
| 105 |
+
label {
|
| 106 |
+
display: flex;
|
| 107 |
+
align-items: center;
|
| 108 |
+
transition: var(--button-transition);
|
| 109 |
+
cursor: pointer;
|
| 110 |
+
box-shadow: var(--checkbox-label-shadow);
|
| 111 |
+
border: var(--checkbox-label-border-width) solid
|
| 112 |
+
var(--checkbox-label-border-color);
|
| 113 |
+
border-radius: var(--button-small-radius);
|
| 114 |
+
background: var(--checkbox-label-background-fill);
|
| 115 |
+
padding: var(--checkbox-label-padding);
|
| 116 |
+
color: var(--checkbox-label-text-color);
|
| 117 |
+
font-weight: var(--checkbox-label-text-weight);
|
| 118 |
+
font-size: var(--checkbox-label-text-size);
|
| 119 |
+
line-height: var(--line-md);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
label:hover {
|
| 123 |
+
background: var(--checkbox-label-background-fill-hover);
|
| 124 |
+
}
|
| 125 |
+
label:focus {
|
| 126 |
+
background: var(--checkbox-label-background-fill-focus);
|
| 127 |
+
}
|
| 128 |
+
label.selected {
|
| 129 |
+
background: var(--checkbox-label-background-fill-selected);
|
| 130 |
+
color: var(--checkbox-label-text-color-selected);
|
| 131 |
+
border-color: var(--checkbox-label-border-color-selected);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
label > * + * {
|
| 135 |
+
margin-left: var(--size-2);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
input {
|
| 139 |
+
--ring-color: transparent;
|
| 140 |
+
position: relative;
|
| 141 |
+
box-shadow: var(--checkbox-shadow);
|
| 142 |
+
border: var(--checkbox-border-width) solid var(--checkbox-border-color);
|
| 143 |
+
border-radius: var(--checkbox-border-radius);
|
| 144 |
+
background-color: var(--checkbox-background-color);
|
| 145 |
+
line-height: var(--line-sm);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
input:checked,
|
| 149 |
+
input:checked:hover,
|
| 150 |
+
input:checked:focus {
|
| 151 |
+
border-color: var(--checkbox-border-color-selected);
|
| 152 |
+
background-image: var(--checkbox-check);
|
| 153 |
+
background-color: var(--checkbox-background-color-selected);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
input:checked:focus {
|
| 157 |
+
border-color: var(--checkbox-border-color-focus);
|
| 158 |
+
background-image: var(--checkbox-check);
|
| 159 |
+
background-color: var(--checkbox-background-color-selected);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
input:hover {
|
| 163 |
+
border-color: var(--checkbox-border-color-hover);
|
| 164 |
+
background-color: var(--checkbox-background-color-hover);
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
input:not(:checked):focus {
|
| 168 |
+
border-color: var(--checkbox-border-color-focus);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
input[disabled],
|
| 172 |
+
.disabled {
|
| 173 |
+
cursor: not-allowed;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
input:hover {
|
| 177 |
+
cursor: pointer;
|
| 178 |
+
}
|
| 179 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/checkboxgroup/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/checkboxgroup",
|
| 3 |
+
"version": "0.6.1",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"main": "./Index.svelte",
|
| 11 |
+
"exports": {
|
| 12 |
+
".": {
|
| 13 |
+
"gradio": "./Index.svelte",
|
| 14 |
+
"svelte": "./dist/Index.svelte",
|
| 15 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 16 |
+
},
|
| 17 |
+
"./example": {
|
| 18 |
+
"gradio": "./Example.svelte",
|
| 19 |
+
"svelte": "./dist/Example.svelte",
|
| 20 |
+
"types": "./dist/Example.svelte.d.ts"
|
| 21 |
+
},
|
| 22 |
+
"./package.json": "./package.json"
|
| 23 |
+
},
|
| 24 |
+
"dependencies": {
|
| 25 |
+
"@gradio/atoms": "workspace:^",
|
| 26 |
+
"@gradio/statustracker": "workspace:^",
|
| 27 |
+
"@gradio/utils": "workspace:^"
|
| 28 |
+
},
|
| 29 |
+
"devDependencies": {
|
| 30 |
+
"@gradio/preview": "workspace:^"
|
| 31 |
+
},
|
| 32 |
+
"peerDependencies": {
|
| 33 |
+
"svelte": "^4.0.0"
|
| 34 |
+
},
|
| 35 |
+
"repository": {
|
| 36 |
+
"type": "git",
|
| 37 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 38 |
+
"directory": "js/checkboxgroup"
|
| 39 |
+
}
|
| 40 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/Example.svelte
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
export let value: string | null;
|
| 3 |
+
export let type: "gallery" | "table";
|
| 4 |
+
export let selected = false;
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<pre
|
| 8 |
+
class:table={type === "table"}
|
| 9 |
+
class:gallery={type === "gallery"}
|
| 10 |
+
class:selected>{value ? value : ""}</pre>
|
| 11 |
+
|
| 12 |
+
<style>
|
| 13 |
+
pre {
|
| 14 |
+
text-align: left;
|
| 15 |
+
}
|
| 16 |
+
.gallery {
|
| 17 |
+
padding: var(--size-1) var(--size-2);
|
| 18 |
+
}
|
| 19 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/Index.svelte
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script context="module" lang="ts">
|
| 2 |
+
export { default as BaseCode } from "./shared/Code.svelte";
|
| 3 |
+
export { default as BaseCopy } from "./shared/Copy.svelte";
|
| 4 |
+
export { default as BaseDownload } from "./shared/Download.svelte";
|
| 5 |
+
export { default as BaseWidget } from "./shared/Widgets.svelte";
|
| 6 |
+
export { default as BaseExample } from "./Example.svelte";
|
| 7 |
+
</script>
|
| 8 |
+
|
| 9 |
+
<script lang="ts">
|
| 10 |
+
import type { Gradio } from "@gradio/utils";
|
| 11 |
+
import { afterUpdate } from "svelte";
|
| 12 |
+
|
| 13 |
+
import type { LoadingStatus } from "@gradio/statustracker";
|
| 14 |
+
|
| 15 |
+
import Code from "./shared/Code.svelte";
|
| 16 |
+
import Widget from "./shared/Widgets.svelte";
|
| 17 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 18 |
+
import { Block, BlockLabel, Empty } from "@gradio/atoms";
|
| 19 |
+
import { Code as CodeIcon } from "@gradio/icons";
|
| 20 |
+
|
| 21 |
+
export let gradio: Gradio<{
|
| 22 |
+
change: typeof value;
|
| 23 |
+
input: never;
|
| 24 |
+
blur: never;
|
| 25 |
+
focus: never;
|
| 26 |
+
clear_status: LoadingStatus;
|
| 27 |
+
}>;
|
| 28 |
+
export let value = "";
|
| 29 |
+
export let value_is_output = false;
|
| 30 |
+
export let language = "";
|
| 31 |
+
export let lines = 5;
|
| 32 |
+
export let max_lines: number | undefined = undefined;
|
| 33 |
+
export let elem_id = "";
|
| 34 |
+
export let elem_classes: string[] = [];
|
| 35 |
+
export let visible = true;
|
| 36 |
+
export let label = gradio.i18n("code.code");
|
| 37 |
+
export let show_label = true;
|
| 38 |
+
export let loading_status: LoadingStatus;
|
| 39 |
+
export let scale: number | null = null;
|
| 40 |
+
export let min_width: number | undefined = undefined;
|
| 41 |
+
export let wrap_lines = false;
|
| 42 |
+
|
| 43 |
+
export let interactive: boolean;
|
| 44 |
+
|
| 45 |
+
let dark_mode = gradio.theme === "dark";
|
| 46 |
+
|
| 47 |
+
function handle_change(): void {
|
| 48 |
+
gradio.dispatch("change", value);
|
| 49 |
+
if (!value_is_output) {
|
| 50 |
+
gradio.dispatch("input");
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
afterUpdate(() => {
|
| 54 |
+
value_is_output = false;
|
| 55 |
+
});
|
| 56 |
+
$: value, handle_change();
|
| 57 |
+
</script>
|
| 58 |
+
|
| 59 |
+
<Block
|
| 60 |
+
height={max_lines && "fit-content"}
|
| 61 |
+
variant={"solid"}
|
| 62 |
+
padding={false}
|
| 63 |
+
{elem_id}
|
| 64 |
+
{elem_classes}
|
| 65 |
+
{visible}
|
| 66 |
+
{scale}
|
| 67 |
+
{min_width}
|
| 68 |
+
>
|
| 69 |
+
<StatusTracker
|
| 70 |
+
autoscroll={gradio.autoscroll}
|
| 71 |
+
i18n={gradio.i18n}
|
| 72 |
+
{...loading_status}
|
| 73 |
+
on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
|
| 74 |
+
/>
|
| 75 |
+
|
| 76 |
+
{#if show_label}
|
| 77 |
+
<BlockLabel Icon={CodeIcon} {show_label} {label} float={false} />
|
| 78 |
+
{/if}
|
| 79 |
+
|
| 80 |
+
{#if !value && !interactive}
|
| 81 |
+
<Empty unpadded_box={true} size="large">
|
| 82 |
+
<CodeIcon />
|
| 83 |
+
</Empty>
|
| 84 |
+
{:else}
|
| 85 |
+
<Widget {language} {value} />
|
| 86 |
+
|
| 87 |
+
<Code
|
| 88 |
+
bind:value
|
| 89 |
+
{language}
|
| 90 |
+
{lines}
|
| 91 |
+
{max_lines}
|
| 92 |
+
{dark_mode}
|
| 93 |
+
{wrap_lines}
|
| 94 |
+
readonly={!interactive}
|
| 95 |
+
on:blur={() => gradio.dispatch("blur")}
|
| 96 |
+
on:focus={() => gradio.dispatch("focus")}
|
| 97 |
+
/>
|
| 98 |
+
{/if}
|
| 99 |
+
</Block>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/Code.svelte
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { createEventDispatcher, onMount } from "svelte";
|
| 3 |
+
import {
|
| 4 |
+
EditorView,
|
| 5 |
+
ViewUpdate,
|
| 6 |
+
keymap,
|
| 7 |
+
placeholder as placeholderExt
|
| 8 |
+
} from "@codemirror/view";
|
| 9 |
+
import { StateEffect, EditorState, type Extension } from "@codemirror/state";
|
| 10 |
+
import { indentWithTab } from "@codemirror/commands";
|
| 11 |
+
|
| 12 |
+
import { basicDark } from "cm6-theme-basic-dark";
|
| 13 |
+
import { basicLight } from "cm6-theme-basic-light";
|
| 14 |
+
import { basicSetup } from "./extensions";
|
| 15 |
+
import { getLanguageExtension } from "./language";
|
| 16 |
+
|
| 17 |
+
export let class_names = "";
|
| 18 |
+
export let value = "";
|
| 19 |
+
export let dark_mode: boolean;
|
| 20 |
+
export let basic = true;
|
| 21 |
+
export let language: string;
|
| 22 |
+
export let lines = 5;
|
| 23 |
+
export let max_lines: number | null = null;
|
| 24 |
+
export let extensions: Extension[] = [];
|
| 25 |
+
export let use_tab = true;
|
| 26 |
+
export let readonly = false;
|
| 27 |
+
export let placeholder: string | HTMLElement | null | undefined = undefined;
|
| 28 |
+
export let wrap_lines = false;
|
| 29 |
+
|
| 30 |
+
const dispatch = createEventDispatcher<{
|
| 31 |
+
change: string;
|
| 32 |
+
blur: undefined;
|
| 33 |
+
focus: undefined;
|
| 34 |
+
}>();
|
| 35 |
+
let lang_extension: Extension | undefined;
|
| 36 |
+
let element: HTMLDivElement;
|
| 37 |
+
let view: EditorView;
|
| 38 |
+
|
| 39 |
+
$: get_lang(language);
|
| 40 |
+
|
| 41 |
+
async function get_lang(val: string): Promise<void> {
|
| 42 |
+
const ext = await getLanguageExtension(val);
|
| 43 |
+
lang_extension = ext;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
$: reconfigure(), lang_extension, readonly;
|
| 47 |
+
$: set_doc(value);
|
| 48 |
+
$: update_lines();
|
| 49 |
+
|
| 50 |
+
function set_doc(new_doc: string): void {
|
| 51 |
+
if (view && new_doc !== view.state.doc.toString()) {
|
| 52 |
+
view.dispatch({
|
| 53 |
+
changes: {
|
| 54 |
+
from: 0,
|
| 55 |
+
to: view.state.doc.length,
|
| 56 |
+
insert: new_doc
|
| 57 |
+
}
|
| 58 |
+
});
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
function update_lines(): void {
|
| 63 |
+
if (view) {
|
| 64 |
+
view.requestMeasure({ read: resize });
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
function create_editor_view(): EditorView {
|
| 69 |
+
const editorView = new EditorView({
|
| 70 |
+
parent: element,
|
| 71 |
+
state: create_editor_state(value)
|
| 72 |
+
});
|
| 73 |
+
editorView.dom.addEventListener("focus", handle_focus, true);
|
| 74 |
+
editorView.dom.addEventListener("blur", handle_blur, true);
|
| 75 |
+
return editorView;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
function handle_focus(): void {
|
| 79 |
+
dispatch("focus");
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
function handle_blur(): void {
|
| 83 |
+
dispatch("blur");
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
function getGutterLineHeight(_view: EditorView): string | null {
|
| 87 |
+
let elements = _view.dom.querySelectorAll<HTMLElement>(".cm-gutterElement");
|
| 88 |
+
if (elements.length === 0) {
|
| 89 |
+
return null;
|
| 90 |
+
}
|
| 91 |
+
for (var i = 0; i < elements.length; i++) {
|
| 92 |
+
let node = elements[i];
|
| 93 |
+
let height = getComputedStyle(node)?.height ?? "0px";
|
| 94 |
+
if (height != "0px") {
|
| 95 |
+
return height;
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
return null;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
function resize(_view: EditorView): any {
|
| 102 |
+
let scroller = _view.dom.querySelector<HTMLElement>(".cm-scroller");
|
| 103 |
+
if (!scroller) {
|
| 104 |
+
return null;
|
| 105 |
+
}
|
| 106 |
+
const lineHeight = getGutterLineHeight(_view);
|
| 107 |
+
if (!lineHeight) {
|
| 108 |
+
return null;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
const minLines = lines == 1 ? 1 : lines + 1;
|
| 112 |
+
scroller.style.minHeight = `calc(${lineHeight} * ${minLines})`;
|
| 113 |
+
if (max_lines)
|
| 114 |
+
scroller.style.maxHeight = `calc(${lineHeight} * ${max_lines + 1})`;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
function handle_change(vu: ViewUpdate): void {
|
| 118 |
+
if (vu.docChanged) {
|
| 119 |
+
const doc = vu.state.doc;
|
| 120 |
+
const text = doc.toString();
|
| 121 |
+
value = text;
|
| 122 |
+
dispatch("change", text);
|
| 123 |
+
}
|
| 124 |
+
view.requestMeasure({ read: resize });
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
function get_extensions(): Extension[] {
|
| 128 |
+
const stateExtensions = [
|
| 129 |
+
...get_base_extensions(
|
| 130 |
+
basic,
|
| 131 |
+
use_tab,
|
| 132 |
+
placeholder,
|
| 133 |
+
readonly,
|
| 134 |
+
lang_extension
|
| 135 |
+
),
|
| 136 |
+
FontTheme,
|
| 137 |
+
...get_theme(),
|
| 138 |
+
...extensions
|
| 139 |
+
];
|
| 140 |
+
return stateExtensions;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
const FontTheme = EditorView.theme({
|
| 144 |
+
"&": {
|
| 145 |
+
fontSize: "var(--text-sm)",
|
| 146 |
+
backgroundColor: "var(--border-color-secondary)"
|
| 147 |
+
},
|
| 148 |
+
".cm-content": {
|
| 149 |
+
paddingTop: "5px",
|
| 150 |
+
paddingBottom: "5px",
|
| 151 |
+
color: "var(--body-text-color)",
|
| 152 |
+
fontFamily: "var(--font-mono)",
|
| 153 |
+
minHeight: "100%"
|
| 154 |
+
},
|
| 155 |
+
".cm-gutterElement": {
|
| 156 |
+
marginRight: "var(--spacing-xs)"
|
| 157 |
+
},
|
| 158 |
+
".cm-gutters": {
|
| 159 |
+
marginRight: "1px",
|
| 160 |
+
borderRight: "1px solid var(--border-color-primary)",
|
| 161 |
+
backgroundColor: "var(--block-background-fill);",
|
| 162 |
+
color: "var(--body-text-color-subdued)"
|
| 163 |
+
},
|
| 164 |
+
".cm-focused": {
|
| 165 |
+
outline: "none"
|
| 166 |
+
},
|
| 167 |
+
".cm-scroller": {
|
| 168 |
+
height: "auto"
|
| 169 |
+
},
|
| 170 |
+
".cm-cursor": {
|
| 171 |
+
borderLeftColor: "var(--body-text-color)"
|
| 172 |
+
}
|
| 173 |
+
});
|
| 174 |
+
|
| 175 |
+
function create_editor_state(_value: string | null | undefined): EditorState {
|
| 176 |
+
return EditorState.create({
|
| 177 |
+
doc: _value ?? undefined,
|
| 178 |
+
extensions: get_extensions()
|
| 179 |
+
});
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function get_base_extensions(
|
| 183 |
+
basic: boolean,
|
| 184 |
+
use_tab: boolean,
|
| 185 |
+
placeholder: string | HTMLElement | null | undefined,
|
| 186 |
+
readonly: boolean,
|
| 187 |
+
lang: Extension | null | undefined
|
| 188 |
+
): Extension[] {
|
| 189 |
+
const extensions: Extension[] = [
|
| 190 |
+
EditorView.editable.of(!readonly),
|
| 191 |
+
EditorState.readOnly.of(readonly),
|
| 192 |
+
EditorView.contentAttributes.of({ "aria-label": "Code input container" })
|
| 193 |
+
];
|
| 194 |
+
|
| 195 |
+
if (basic) {
|
| 196 |
+
extensions.push(basicSetup);
|
| 197 |
+
}
|
| 198 |
+
if (use_tab) {
|
| 199 |
+
extensions.push(keymap.of([indentWithTab]));
|
| 200 |
+
}
|
| 201 |
+
if (placeholder) {
|
| 202 |
+
extensions.push(placeholderExt(placeholder));
|
| 203 |
+
}
|
| 204 |
+
if (lang) {
|
| 205 |
+
extensions.push(lang);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
extensions.push(EditorView.updateListener.of(handle_change));
|
| 209 |
+
if (wrap_lines) {
|
| 210 |
+
extensions.push(EditorView.lineWrapping);
|
| 211 |
+
}
|
| 212 |
+
return extensions;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
function get_theme(): Extension[] {
|
| 216 |
+
const extensions: Extension[] = [];
|
| 217 |
+
|
| 218 |
+
if (dark_mode) {
|
| 219 |
+
extensions.push(basicDark);
|
| 220 |
+
} else {
|
| 221 |
+
extensions.push(basicLight);
|
| 222 |
+
}
|
| 223 |
+
return extensions;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
function reconfigure(): void {
|
| 227 |
+
view?.dispatch({
|
| 228 |
+
effects: StateEffect.reconfigure.of(get_extensions())
|
| 229 |
+
});
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
onMount(() => {
|
| 233 |
+
view = create_editor_view();
|
| 234 |
+
return () => view?.destroy();
|
| 235 |
+
});
|
| 236 |
+
</script>
|
| 237 |
+
|
| 238 |
+
<div class="wrap">
|
| 239 |
+
<div class="codemirror-wrapper {class_names}" bind:this={element} />
|
| 240 |
+
</div>
|
| 241 |
+
|
| 242 |
+
<style>
|
| 243 |
+
.wrap {
|
| 244 |
+
display: flex;
|
| 245 |
+
flex-direction: column;
|
| 246 |
+
flex-grow: 1;
|
| 247 |
+
margin: 0;
|
| 248 |
+
padding: 0;
|
| 249 |
+
height: 100%;
|
| 250 |
+
}
|
| 251 |
+
.codemirror-wrapper {
|
| 252 |
+
flex-grow: 1;
|
| 253 |
+
overflow: auto;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
:global(.cm-editor) {
|
| 257 |
+
height: 100%;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/* Dunno why this doesn't work through the theme API -- don't remove*/
|
| 261 |
+
:global(.cm-selectionBackground) {
|
| 262 |
+
background-color: #b9d2ff30 !important;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
:global(.cm-focused) {
|
| 266 |
+
outline: none !important;
|
| 267 |
+
}
|
| 268 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/Widgets.svelte
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import Copy from "./Copy.svelte";
|
| 3 |
+
import Download from "./Download.svelte";
|
| 4 |
+
import { IconButtonWrapper } from "@gradio/atoms";
|
| 5 |
+
|
| 6 |
+
export let value: string;
|
| 7 |
+
export let language: string;
|
| 8 |
+
</script>
|
| 9 |
+
|
| 10 |
+
<IconButtonWrapper>
|
| 11 |
+
<Download {value} {language} />
|
| 12 |
+
<Copy {value} />
|
| 13 |
+
</IconButtonWrapper>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/extensions.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Extension } from "@codemirror/state";
|
| 2 |
+
import {
|
| 3 |
+
lineNumbers,
|
| 4 |
+
highlightSpecialChars,
|
| 5 |
+
drawSelection,
|
| 6 |
+
rectangularSelection,
|
| 7 |
+
crosshairCursor,
|
| 8 |
+
keymap
|
| 9 |
+
} from "@codemirror/view";
|
| 10 |
+
export { EditorView } from "@codemirror/view";
|
| 11 |
+
import { EditorState } from "@codemirror/state";
|
| 12 |
+
import {
|
| 13 |
+
foldGutter,
|
| 14 |
+
indentOnInput,
|
| 15 |
+
syntaxHighlighting,
|
| 16 |
+
defaultHighlightStyle,
|
| 17 |
+
foldKeymap
|
| 18 |
+
} from "@codemirror/language";
|
| 19 |
+
import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
| 20 |
+
import {
|
| 21 |
+
closeBrackets,
|
| 22 |
+
closeBracketsKeymap,
|
| 23 |
+
completionKeymap
|
| 24 |
+
} from "@codemirror/autocomplete";
|
| 25 |
+
import { lintKeymap } from "@codemirror/lint";
|
| 26 |
+
|
| 27 |
+
export const basicSetup: Extension = /*@__PURE__*/ ((): Extension[] => [
|
| 28 |
+
lineNumbers(),
|
| 29 |
+
highlightSpecialChars(),
|
| 30 |
+
history(),
|
| 31 |
+
foldGutter(),
|
| 32 |
+
drawSelection(),
|
| 33 |
+
EditorState.allowMultipleSelections.of(true),
|
| 34 |
+
indentOnInput(),
|
| 35 |
+
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
| 36 |
+
closeBrackets(),
|
| 37 |
+
rectangularSelection(),
|
| 38 |
+
crosshairCursor(),
|
| 39 |
+
|
| 40 |
+
keymap.of([
|
| 41 |
+
...closeBracketsKeymap,
|
| 42 |
+
...defaultKeymap,
|
| 43 |
+
...historyKeymap,
|
| 44 |
+
...foldKeymap,
|
| 45 |
+
...completionKeymap,
|
| 46 |
+
...lintKeymap
|
| 47 |
+
])
|
| 48 |
+
])();
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/frontmatter.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type {
|
| 2 |
+
Element,
|
| 3 |
+
MarkdownExtension,
|
| 4 |
+
BlockContext,
|
| 5 |
+
Line
|
| 6 |
+
} from "@lezer/markdown";
|
| 7 |
+
import { parseMixed } from "@lezer/common";
|
| 8 |
+
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
|
| 9 |
+
import { foldInside, foldNodeProp, StreamLanguage } from "@codemirror/language";
|
| 10 |
+
import { styleTags, tags } from "@lezer/highlight";
|
| 11 |
+
|
| 12 |
+
const frontMatterFence = /^---\s*$/m;
|
| 13 |
+
|
| 14 |
+
export const frontmatter: MarkdownExtension = {
|
| 15 |
+
defineNodes: [{ name: "Frontmatter", block: true }, "FrontmatterMark"],
|
| 16 |
+
props: [
|
| 17 |
+
styleTags({
|
| 18 |
+
Frontmatter: [tags.documentMeta, tags.monospace],
|
| 19 |
+
FrontmatterMark: tags.processingInstruction
|
| 20 |
+
}),
|
| 21 |
+
foldNodeProp.add({
|
| 22 |
+
Frontmatter: foldInside,
|
| 23 |
+
FrontmatterMark: () => null
|
| 24 |
+
})
|
| 25 |
+
],
|
| 26 |
+
wrap: parseMixed((node) => {
|
| 27 |
+
const { parser } = StreamLanguage.define(yaml);
|
| 28 |
+
if (node.type.name === "Frontmatter") {
|
| 29 |
+
return {
|
| 30 |
+
parser,
|
| 31 |
+
overlay: [{ from: node.from + 4, to: node.to - 4 }]
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
+
return null;
|
| 35 |
+
}),
|
| 36 |
+
parseBlock: [
|
| 37 |
+
{
|
| 38 |
+
name: "Frontmatter",
|
| 39 |
+
before: "HorizontalRule",
|
| 40 |
+
parse: (cx: BlockContext, line: Line): boolean => {
|
| 41 |
+
let end: number | undefined = undefined;
|
| 42 |
+
const children = new Array<Element>();
|
| 43 |
+
if (cx.lineStart === 0 && frontMatterFence.test(line.text)) {
|
| 44 |
+
children.push(cx.elt("FrontmatterMark", 0, 4));
|
| 45 |
+
while (cx.nextLine()) {
|
| 46 |
+
if (frontMatterFence.test(line.text)) {
|
| 47 |
+
end = cx.lineStart + 4;
|
| 48 |
+
break;
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
if (end !== undefined) {
|
| 52 |
+
children.push(cx.elt("FrontmatterMark", end - 4, end));
|
| 53 |
+
cx.addElement(cx.elt("Frontmatter", 0, end, children));
|
| 54 |
+
}
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
return false;
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
]
|
| 61 |
+
};
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/code/shared/language.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Extension } from "@codemirror/state";
|
| 2 |
+
import { StreamLanguage } from "@codemirror/language";
|
| 3 |
+
import { sql } from "@codemirror/legacy-modes/mode/sql";
|
| 4 |
+
import { _ } from "svelte-i18n";
|
| 5 |
+
|
| 6 |
+
const possible_langs = [
|
| 7 |
+
"python",
|
| 8 |
+
"c",
|
| 9 |
+
"cpp",
|
| 10 |
+
"markdown",
|
| 11 |
+
"json",
|
| 12 |
+
"html",
|
| 13 |
+
"css",
|
| 14 |
+
"javascript",
|
| 15 |
+
"jinja2",
|
| 16 |
+
"typescript",
|
| 17 |
+
"yaml",
|
| 18 |
+
"dockerfile",
|
| 19 |
+
"shell",
|
| 20 |
+
"r",
|
| 21 |
+
"sql"
|
| 22 |
+
];
|
| 23 |
+
|
| 24 |
+
const sql_dialects = [
|
| 25 |
+
"standardSQL",
|
| 26 |
+
"msSQL",
|
| 27 |
+
"mySQL",
|
| 28 |
+
"mariaDB",
|
| 29 |
+
"sqlite",
|
| 30 |
+
"cassandra",
|
| 31 |
+
"plSQL",
|
| 32 |
+
"hive",
|
| 33 |
+
"pgSQL",
|
| 34 |
+
"gql",
|
| 35 |
+
"gpSQL",
|
| 36 |
+
"sparkSQL",
|
| 37 |
+
"esper"
|
| 38 |
+
] as const;
|
| 39 |
+
|
| 40 |
+
const lang_map: Record<string, (() => Promise<Extension>) | undefined> = {
|
| 41 |
+
python: () => import("@codemirror/lang-python").then((m) => m.python()),
|
| 42 |
+
c: () =>
|
| 43 |
+
import("@codemirror/legacy-modes/mode/clike").then((m) =>
|
| 44 |
+
StreamLanguage.define(m.c)
|
| 45 |
+
),
|
| 46 |
+
cpp: () =>
|
| 47 |
+
import("@codemirror/legacy-modes/mode/clike").then((m) =>
|
| 48 |
+
StreamLanguage.define(m.cpp)
|
| 49 |
+
),
|
| 50 |
+
markdown: async () => {
|
| 51 |
+
const [md, frontmatter] = await Promise.all([
|
| 52 |
+
import("@codemirror/lang-markdown"),
|
| 53 |
+
import("./frontmatter")
|
| 54 |
+
]);
|
| 55 |
+
return md.markdown({ extensions: [frontmatter.frontmatter] });
|
| 56 |
+
},
|
| 57 |
+
json: () => import("@codemirror/lang-json").then((m) => m.json()),
|
| 58 |
+
html: () => import("@codemirror/lang-html").then((m) => m.html()),
|
| 59 |
+
css: () => import("@codemirror/lang-css").then((m) => m.css()),
|
| 60 |
+
javascript: () =>
|
| 61 |
+
import("@codemirror/lang-javascript").then((m) => m.javascript()),
|
| 62 |
+
jinja2: () =>
|
| 63 |
+
import("@codemirror/legacy-modes/mode/jinja2").then((m) =>
|
| 64 |
+
StreamLanguage.define(m.jinja2)
|
| 65 |
+
),
|
| 66 |
+
typescript: () =>
|
| 67 |
+
import("@codemirror/lang-javascript").then((m) =>
|
| 68 |
+
m.javascript({ typescript: true })
|
| 69 |
+
),
|
| 70 |
+
yaml: () =>
|
| 71 |
+
import("@codemirror/legacy-modes/mode/yaml").then((m) =>
|
| 72 |
+
StreamLanguage.define(m.yaml)
|
| 73 |
+
),
|
| 74 |
+
dockerfile: () =>
|
| 75 |
+
import("@codemirror/legacy-modes/mode/dockerfile").then((m) =>
|
| 76 |
+
StreamLanguage.define(m.dockerFile)
|
| 77 |
+
),
|
| 78 |
+
shell: () =>
|
| 79 |
+
import("@codemirror/legacy-modes/mode/shell").then((m) =>
|
| 80 |
+
StreamLanguage.define(m.shell)
|
| 81 |
+
),
|
| 82 |
+
r: () =>
|
| 83 |
+
import("@codemirror/legacy-modes/mode/r").then((m) =>
|
| 84 |
+
StreamLanguage.define(m.r)
|
| 85 |
+
),
|
| 86 |
+
sql: () =>
|
| 87 |
+
import("@codemirror/legacy-modes/mode/sql").then((m) =>
|
| 88 |
+
StreamLanguage.define(m.standardSQL)
|
| 89 |
+
),
|
| 90 |
+
...Object.fromEntries(
|
| 91 |
+
sql_dialects.map((dialect) => [
|
| 92 |
+
"sql-" + dialect,
|
| 93 |
+
() =>
|
| 94 |
+
import("@codemirror/legacy-modes/mode/sql").then((m) =>
|
| 95 |
+
StreamLanguage.define(m[dialect])
|
| 96 |
+
)
|
| 97 |
+
])
|
| 98 |
+
)
|
| 99 |
+
} as const;
|
| 100 |
+
|
| 101 |
+
const alias_map: Record<string, string> = {
|
| 102 |
+
py: "python",
|
| 103 |
+
md: "markdown",
|
| 104 |
+
js: "javascript",
|
| 105 |
+
ts: "typescript",
|
| 106 |
+
sh: "shell"
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
export async function getLanguageExtension(
|
| 110 |
+
lang: string
|
| 111 |
+
): Promise<Extension | undefined> {
|
| 112 |
+
const _lang = lang_map[lang] || lang_map[alias_map[lang]] || undefined;
|
| 113 |
+
if (_lang) {
|
| 114 |
+
return _lang();
|
| 115 |
+
}
|
| 116 |
+
return undefined;
|
| 117 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/Index.svelte
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts" context="module">
|
| 2 |
+
export { default as BaseJSON } from "./shared/JSON.svelte";
|
| 3 |
+
</script>
|
| 4 |
+
|
| 5 |
+
<script lang="ts">
|
| 6 |
+
import type { Gradio } from "@gradio/utils";
|
| 7 |
+
import JSON from "./shared/JSON.svelte";
|
| 8 |
+
import { Block, BlockLabel } from "@gradio/atoms";
|
| 9 |
+
import { JSON as JSONIcon } from "@gradio/icons";
|
| 10 |
+
|
| 11 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 12 |
+
import type { LoadingStatus } from "@gradio/statustracker";
|
| 13 |
+
|
| 14 |
+
export let elem_id = "";
|
| 15 |
+
export let elem_classes: string[] = [];
|
| 16 |
+
export let visible = true;
|
| 17 |
+
export let value: any;
|
| 18 |
+
let old_value: any;
|
| 19 |
+
export let loading_status: LoadingStatus;
|
| 20 |
+
export let label: string;
|
| 21 |
+
export let show_label: boolean;
|
| 22 |
+
export let container = true;
|
| 23 |
+
export let scale: number | null = null;
|
| 24 |
+
export let min_width: number | undefined = undefined;
|
| 25 |
+
export let gradio: Gradio<{
|
| 26 |
+
change: never;
|
| 27 |
+
clear_status: LoadingStatus;
|
| 28 |
+
}>;
|
| 29 |
+
export let open = false;
|
| 30 |
+
export let theme_mode: "system" | "light" | "dark";
|
| 31 |
+
export let show_indices: boolean;
|
| 32 |
+
export let height: number | string | undefined;
|
| 33 |
+
export let min_height: number | string | undefined;
|
| 34 |
+
export let max_height: number | string | undefined;
|
| 35 |
+
|
| 36 |
+
$: {
|
| 37 |
+
if (value !== old_value) {
|
| 38 |
+
old_value = value;
|
| 39 |
+
gradio.dispatch("change");
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
let label_height = 0;
|
| 44 |
+
</script>
|
| 45 |
+
|
| 46 |
+
<Block
|
| 47 |
+
{visible}
|
| 48 |
+
test_id="json"
|
| 49 |
+
{elem_id}
|
| 50 |
+
{elem_classes}
|
| 51 |
+
{container}
|
| 52 |
+
{scale}
|
| 53 |
+
{min_width}
|
| 54 |
+
padding={false}
|
| 55 |
+
allow_overflow={true}
|
| 56 |
+
overflow_behavior="auto"
|
| 57 |
+
{height}
|
| 58 |
+
{min_height}
|
| 59 |
+
{max_height}
|
| 60 |
+
>
|
| 61 |
+
<div bind:clientHeight={label_height}>
|
| 62 |
+
{#if label}
|
| 63 |
+
<BlockLabel
|
| 64 |
+
Icon={JSONIcon}
|
| 65 |
+
{show_label}
|
| 66 |
+
{label}
|
| 67 |
+
float={false}
|
| 68 |
+
disable={container === false}
|
| 69 |
+
/>
|
| 70 |
+
{/if}
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<StatusTracker
|
| 74 |
+
autoscroll={gradio.autoscroll}
|
| 75 |
+
i18n={gradio.i18n}
|
| 76 |
+
{...loading_status}
|
| 77 |
+
on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
|
| 78 |
+
/>
|
| 79 |
+
|
| 80 |
+
<JSON {value} {open} {theme_mode} {show_indices} {label_height} />
|
| 81 |
+
</Block>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/json",
|
| 3 |
+
"version": "0.5.1",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"dependencies": {
|
| 10 |
+
"@gradio/atoms": "workspace:^",
|
| 11 |
+
"@gradio/icons": "workspace:^",
|
| 12 |
+
"@gradio/statustracker": "workspace:^",
|
| 13 |
+
"@gradio/utils": "workspace:^"
|
| 14 |
+
},
|
| 15 |
+
"devDependencies": {
|
| 16 |
+
"@gradio/preview": "workspace:^"
|
| 17 |
+
},
|
| 18 |
+
"main": "./Index.svelte",
|
| 19 |
+
"main_changeset": true,
|
| 20 |
+
"exports": {
|
| 21 |
+
".": {
|
| 22 |
+
"gradio": "./Index.svelte",
|
| 23 |
+
"svelte": "./dist/Index.svelte",
|
| 24 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 25 |
+
},
|
| 26 |
+
"./package.json": "./package.json"
|
| 27 |
+
},
|
| 28 |
+
"peerDependencies": {
|
| 29 |
+
"svelte": "^4.0.0"
|
| 30 |
+
},
|
| 31 |
+
"repository": {
|
| 32 |
+
"type": "git",
|
| 33 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 34 |
+
"directory": "js/json"
|
| 35 |
+
}
|
| 36 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/shared/JSON.svelte
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { onDestroy } from "svelte";
|
| 3 |
+
import { JSON as JSONIcon } from "@gradio/icons";
|
| 4 |
+
import { Empty, IconButtonWrapper, IconButton } from "@gradio/atoms";
|
| 5 |
+
import JSONNode from "./JSONNode.svelte";
|
| 6 |
+
import { Copy, Check } from "@gradio/icons";
|
| 7 |
+
|
| 8 |
+
export let value: any = {};
|
| 9 |
+
export let open = false;
|
| 10 |
+
export let theme_mode: "system" | "light" | "dark" = "system";
|
| 11 |
+
export let show_indices = false;
|
| 12 |
+
export let label_height: number;
|
| 13 |
+
|
| 14 |
+
$: json_max_height = `calc(100% - ${label_height}px)`;
|
| 15 |
+
|
| 16 |
+
let copied = false;
|
| 17 |
+
let timer: NodeJS.Timeout;
|
| 18 |
+
|
| 19 |
+
function copy_feedback(): void {
|
| 20 |
+
copied = true;
|
| 21 |
+
if (timer) clearTimeout(timer);
|
| 22 |
+
timer = setTimeout(() => {
|
| 23 |
+
copied = false;
|
| 24 |
+
}, 1000);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
async function handle_copy(): Promise<void> {
|
| 28 |
+
if ("clipboard" in navigator) {
|
| 29 |
+
await navigator.clipboard.writeText(JSON.stringify(value, null, 2));
|
| 30 |
+
copy_feedback();
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
function is_empty(obj: object): boolean {
|
| 35 |
+
return (
|
| 36 |
+
obj &&
|
| 37 |
+
Object.keys(obj).length === 0 &&
|
| 38 |
+
Object.getPrototypeOf(obj) === Object.prototype &&
|
| 39 |
+
JSON.stringify(obj) === JSON.stringify({})
|
| 40 |
+
);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
onDestroy(() => {
|
| 44 |
+
if (timer) clearTimeout(timer);
|
| 45 |
+
});
|
| 46 |
+
</script>
|
| 47 |
+
|
| 48 |
+
{#if value && value !== '""' && !is_empty(value)}
|
| 49 |
+
<IconButtonWrapper>
|
| 50 |
+
<IconButton
|
| 51 |
+
show_label={false}
|
| 52 |
+
label={copied ? "Copied" : "Copy"}
|
| 53 |
+
Icon={copied ? Check : Copy}
|
| 54 |
+
on:click={() => handle_copy()}
|
| 55 |
+
/>
|
| 56 |
+
</IconButtonWrapper>
|
| 57 |
+
<div class="json-holder" style:max-height={json_max_height}>
|
| 58 |
+
<JSONNode
|
| 59 |
+
{value}
|
| 60 |
+
depth={0}
|
| 61 |
+
is_root={true}
|
| 62 |
+
{open}
|
| 63 |
+
{theme_mode}
|
| 64 |
+
{show_indices}
|
| 65 |
+
/>
|
| 66 |
+
</div>
|
| 67 |
+
{:else}
|
| 68 |
+
<div class="empty-wrapper">
|
| 69 |
+
<Empty>
|
| 70 |
+
<JSONIcon />
|
| 71 |
+
</Empty>
|
| 72 |
+
</div>
|
| 73 |
+
{/if}
|
| 74 |
+
|
| 75 |
+
<style>
|
| 76 |
+
:global(.copied svg) {
|
| 77 |
+
animation: fade ease 300ms;
|
| 78 |
+
animation-fill-mode: forwards;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
@keyframes fade {
|
| 82 |
+
0% {
|
| 83 |
+
opacity: 0;
|
| 84 |
+
}
|
| 85 |
+
100% {
|
| 86 |
+
opacity: 1;
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.json-holder {
|
| 91 |
+
padding: var(--size-2);
|
| 92 |
+
overflow-y: auto;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.empty-wrapper {
|
| 96 |
+
min-height: calc(var(--size-32) - 20px);
|
| 97 |
+
height: 100%;
|
| 98 |
+
}
|
| 99 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/json/shared/JSONNode.svelte
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { onMount, createEventDispatcher, tick, afterUpdate } from "svelte";
|
| 3 |
+
|
| 4 |
+
export let value: any;
|
| 5 |
+
export let depth = 0;
|
| 6 |
+
export let is_root = false;
|
| 7 |
+
export let is_last_item = true;
|
| 8 |
+
export let key: string | number | null = null;
|
| 9 |
+
export let open = false;
|
| 10 |
+
export let theme_mode: "system" | "light" | "dark" = "system";
|
| 11 |
+
export let show_indices = false;
|
| 12 |
+
|
| 13 |
+
const dispatch = createEventDispatcher();
|
| 14 |
+
let root_element: HTMLElement;
|
| 15 |
+
let collapsed = open ? false : depth >= 3;
|
| 16 |
+
let child_nodes: any[] = [];
|
| 17 |
+
|
| 18 |
+
function is_collapsible(val: any): boolean {
|
| 19 |
+
return val !== null && (typeof val === "object" || Array.isArray(val));
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
async function toggle_collapse(): Promise<void> {
|
| 23 |
+
collapsed = !collapsed;
|
| 24 |
+
await tick();
|
| 25 |
+
dispatch("toggle", { collapsed, depth });
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
function get_collapsed_preview(val: any): string {
|
| 29 |
+
if (Array.isArray(val)) return `Array(${val.length})`;
|
| 30 |
+
if (typeof val === "object" && val !== null)
|
| 31 |
+
return `Object(${Object.keys(val).length})`;
|
| 32 |
+
return String(val);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
$: if (is_collapsible(value)) {
|
| 36 |
+
child_nodes = Object.entries(value);
|
| 37 |
+
} else {
|
| 38 |
+
child_nodes = [];
|
| 39 |
+
}
|
| 40 |
+
$: if (is_root && root_element) {
|
| 41 |
+
updateLineNumbers();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
function updateLineNumbers(): void {
|
| 45 |
+
const lines = root_element.querySelectorAll(".line");
|
| 46 |
+
lines.forEach((line, index) => {
|
| 47 |
+
const line_number = line.querySelector(".line-number");
|
| 48 |
+
if (line_number) {
|
| 49 |
+
line_number.setAttribute("data-pseudo-content", (index + 1).toString());
|
| 50 |
+
line_number?.setAttribute(
|
| 51 |
+
"aria-roledescription",
|
| 52 |
+
`Line number ${index + 1}`
|
| 53 |
+
);
|
| 54 |
+
line_number?.setAttribute("title", `Line number ${index + 1}`);
|
| 55 |
+
}
|
| 56 |
+
});
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
onMount(() => {
|
| 60 |
+
if (is_root) {
|
| 61 |
+
updateLineNumbers();
|
| 62 |
+
}
|
| 63 |
+
});
|
| 64 |
+
|
| 65 |
+
afterUpdate(() => {
|
| 66 |
+
if (is_root) {
|
| 67 |
+
updateLineNumbers();
|
| 68 |
+
}
|
| 69 |
+
});
|
| 70 |
+
</script>
|
| 71 |
+
|
| 72 |
+
<div
|
| 73 |
+
class="json-node"
|
| 74 |
+
class:root={is_root}
|
| 75 |
+
class:dark-mode={theme_mode === "dark"}
|
| 76 |
+
bind:this={root_element}
|
| 77 |
+
on:toggle
|
| 78 |
+
style="--depth: {depth};"
|
| 79 |
+
>
|
| 80 |
+
<div class="line" class:collapsed>
|
| 81 |
+
<span class="line-number"></span>
|
| 82 |
+
<span class="content">
|
| 83 |
+
{#if is_collapsible(value)}
|
| 84 |
+
<button
|
| 85 |
+
data-pseudo-content={collapsed ? "▶" : "▼"}
|
| 86 |
+
aria-label={collapsed ? "Expand" : "Collapse"}
|
| 87 |
+
class="toggle"
|
| 88 |
+
on:click={toggle_collapse}
|
| 89 |
+
/>
|
| 90 |
+
{/if}
|
| 91 |
+
{#if key !== null}
|
| 92 |
+
<span class="key">"{key}"</span><span class="punctuation colon"
|
| 93 |
+
>:
|
| 94 |
+
</span>
|
| 95 |
+
{/if}
|
| 96 |
+
{#if is_collapsible(value)}
|
| 97 |
+
<span
|
| 98 |
+
class="punctuation bracket"
|
| 99 |
+
class:square-bracket={Array.isArray(value)}
|
| 100 |
+
>{Array.isArray(value) ? "[" : "{"}</span
|
| 101 |
+
>
|
| 102 |
+
{#if collapsed}
|
| 103 |
+
<button on:click={toggle_collapse} class="preview">
|
| 104 |
+
{get_collapsed_preview(value)}
|
| 105 |
+
</button>
|
| 106 |
+
<span
|
| 107 |
+
class="punctuation bracket"
|
| 108 |
+
class:square-bracket={Array.isArray(value)}
|
| 109 |
+
>{Array.isArray(value) ? "]" : "}"}</span
|
| 110 |
+
>
|
| 111 |
+
{/if}
|
| 112 |
+
{:else if typeof value === "string"}
|
| 113 |
+
<span class="value string">"{value}"</span>
|
| 114 |
+
{:else if typeof value === "number"}
|
| 115 |
+
<span class="value number">{value}</span>
|
| 116 |
+
{:else if typeof value === "boolean"}
|
| 117 |
+
<span class="value bool">{value.toString()}</span>
|
| 118 |
+
{:else if value === null}
|
| 119 |
+
<span class="value null">null</span>
|
| 120 |
+
{:else}
|
| 121 |
+
<span>{value}</span>
|
| 122 |
+
{/if}
|
| 123 |
+
{#if !is_last_item && (!is_collapsible(value) || collapsed)}
|
| 124 |
+
<span class="punctuation">,</span>
|
| 125 |
+
{/if}
|
| 126 |
+
</span>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
{#if is_collapsible(value)}
|
| 130 |
+
<div class="children" class:hidden={collapsed}>
|
| 131 |
+
{#each child_nodes as [subKey, subVal], i}
|
| 132 |
+
<svelte:self
|
| 133 |
+
value={subVal}
|
| 134 |
+
depth={depth + 1}
|
| 135 |
+
is_last_item={i === child_nodes.length - 1}
|
| 136 |
+
key={subKey}
|
| 137 |
+
{open}
|
| 138 |
+
{theme_mode}
|
| 139 |
+
{show_indices}
|
| 140 |
+
on:toggle
|
| 141 |
+
/>
|
| 142 |
+
{/each}
|
| 143 |
+
<div class="line">
|
| 144 |
+
<span class="line-number"></span>
|
| 145 |
+
<span class="content">
|
| 146 |
+
<span
|
| 147 |
+
class="punctuation bracket"
|
| 148 |
+
class:square-bracket={Array.isArray(value)}
|
| 149 |
+
>{Array.isArray(value) ? "]" : "}"}</span
|
| 150 |
+
>
|
| 151 |
+
{#if !is_last_item}<span class="punctuation">,</span>{/if}
|
| 152 |
+
</span>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
{/if}
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<style>
|
| 159 |
+
.json-node {
|
| 160 |
+
font-family: var(--font-mono);
|
| 161 |
+
--text-color: #d18770;
|
| 162 |
+
--key-color: var(--text-color);
|
| 163 |
+
--string-color: #ce9178;
|
| 164 |
+
--number-color: #719fad;
|
| 165 |
+
|
| 166 |
+
--bracket-color: #5d8585;
|
| 167 |
+
--square-bracket-color: #be6069;
|
| 168 |
+
--punctuation-color: #8fbcbb;
|
| 169 |
+
--line-number-color: #6a737d;
|
| 170 |
+
--separator-color: var(--line-number-color);
|
| 171 |
+
}
|
| 172 |
+
.json-node.dark-mode {
|
| 173 |
+
--bracket-color: #7eb4b3;
|
| 174 |
+
--number-color: #638d9a;
|
| 175 |
+
}
|
| 176 |
+
.json-node.root {
|
| 177 |
+
position: relative;
|
| 178 |
+
padding-left: var(--size-14);
|
| 179 |
+
}
|
| 180 |
+
.json-node.root::before {
|
| 181 |
+
content: "";
|
| 182 |
+
position: absolute;
|
| 183 |
+
top: 0;
|
| 184 |
+
bottom: 0;
|
| 185 |
+
left: var(--size-11);
|
| 186 |
+
width: 1px;
|
| 187 |
+
background-color: var(--separator-color);
|
| 188 |
+
}
|
| 189 |
+
.line {
|
| 190 |
+
display: flex;
|
| 191 |
+
align-items: flex-start;
|
| 192 |
+
padding: 0;
|
| 193 |
+
margin: 0;
|
| 194 |
+
line-height: var(--line-md);
|
| 195 |
+
}
|
| 196 |
+
.line-number {
|
| 197 |
+
position: absolute;
|
| 198 |
+
left: 0;
|
| 199 |
+
width: calc(var(--size-7));
|
| 200 |
+
text-align: right;
|
| 201 |
+
color: var(--line-number-color);
|
| 202 |
+
user-select: none;
|
| 203 |
+
text-overflow: ellipsis;
|
| 204 |
+
text-overflow: ellipsis;
|
| 205 |
+
direction: rtl;
|
| 206 |
+
overflow: hidden;
|
| 207 |
+
}
|
| 208 |
+
.content {
|
| 209 |
+
flex: 1;
|
| 210 |
+
display: flex;
|
| 211 |
+
align-items: center;
|
| 212 |
+
padding-left: calc(var(--depth) * var(--size-2));
|
| 213 |
+
flex-wrap: wrap;
|
| 214 |
+
}
|
| 215 |
+
.children {
|
| 216 |
+
padding-left: var(--size-4);
|
| 217 |
+
}
|
| 218 |
+
.children.hidden {
|
| 219 |
+
display: none;
|
| 220 |
+
}
|
| 221 |
+
.key {
|
| 222 |
+
color: var(--key-color);
|
| 223 |
+
}
|
| 224 |
+
.string {
|
| 225 |
+
color: var(--string-color);
|
| 226 |
+
}
|
| 227 |
+
.number {
|
| 228 |
+
color: var(--number-color);
|
| 229 |
+
}
|
| 230 |
+
.bool {
|
| 231 |
+
color: var(--text-color);
|
| 232 |
+
}
|
| 233 |
+
.null {
|
| 234 |
+
color: var(--text-color);
|
| 235 |
+
}
|
| 236 |
+
.value {
|
| 237 |
+
margin-left: var(--spacing-md);
|
| 238 |
+
}
|
| 239 |
+
.punctuation {
|
| 240 |
+
color: var(--punctuation-color);
|
| 241 |
+
}
|
| 242 |
+
.bracket {
|
| 243 |
+
margin-left: var(--spacing-sm);
|
| 244 |
+
color: var(--bracket-color);
|
| 245 |
+
}
|
| 246 |
+
.square-bracket {
|
| 247 |
+
margin-left: var(--spacing-sm);
|
| 248 |
+
color: var(--square-bracket-color);
|
| 249 |
+
}
|
| 250 |
+
.toggle,
|
| 251 |
+
.preview {
|
| 252 |
+
background: none;
|
| 253 |
+
border: none;
|
| 254 |
+
color: inherit;
|
| 255 |
+
cursor: pointer;
|
| 256 |
+
padding: 0;
|
| 257 |
+
margin: 0;
|
| 258 |
+
}
|
| 259 |
+
.toggle {
|
| 260 |
+
user-select: none;
|
| 261 |
+
margin-right: var(--spacing-md);
|
| 262 |
+
}
|
| 263 |
+
.preview {
|
| 264 |
+
margin: 0 var(--spacing-sm) 0 var(--spacing-lg);
|
| 265 |
+
}
|
| 266 |
+
.preview:hover {
|
| 267 |
+
text-decoration: underline;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
:global([data-pseudo-content])::before {
|
| 271 |
+
content: attr(data-pseudo-content);
|
| 272 |
+
}
|
| 273 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/multimodaltextbox/Index.svelte
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<svelte:options accessors={true} />
|
| 2 |
+
|
| 3 |
+
<script context="module" lang="ts">
|
| 4 |
+
export { default as BaseMultimodalTextbox } from "./shared/MultimodalTextbox.svelte";
|
| 5 |
+
export { default as BaseExample } from "./Example.svelte";
|
| 6 |
+
</script>
|
| 7 |
+
|
| 8 |
+
<script lang="ts">
|
| 9 |
+
import type { Gradio, SelectData } from "@gradio/utils";
|
| 10 |
+
import MultimodalTextbox from "./shared/MultimodalTextbox.svelte";
|
| 11 |
+
import { Block } from "@gradio/atoms";
|
| 12 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 13 |
+
import type { LoadingStatus } from "@gradio/statustracker";
|
| 14 |
+
import type { FileData } from "@gradio/client";
|
| 15 |
+
|
| 16 |
+
export let gradio: Gradio<{
|
| 17 |
+
change: typeof value;
|
| 18 |
+
submit: never;
|
| 19 |
+
stop: never;
|
| 20 |
+
blur: never;
|
| 21 |
+
select: SelectData;
|
| 22 |
+
input: never;
|
| 23 |
+
focus: never;
|
| 24 |
+
error: string;
|
| 25 |
+
clear_status: LoadingStatus;
|
| 26 |
+
}>;
|
| 27 |
+
export let elem_id = "";
|
| 28 |
+
export let elem_classes: string[] = [];
|
| 29 |
+
export let visible = true;
|
| 30 |
+
export let value: { text: string; files: FileData[] } = {
|
| 31 |
+
text: "",
|
| 32 |
+
files: []
|
| 33 |
+
};
|
| 34 |
+
export let file_types: string[] | null = null;
|
| 35 |
+
export let lines: number;
|
| 36 |
+
export let placeholder = "";
|
| 37 |
+
export let label = "MultimodalTextbox";
|
| 38 |
+
export let info: string | undefined = undefined;
|
| 39 |
+
export let show_label: boolean;
|
| 40 |
+
export let max_lines: number;
|
| 41 |
+
export let container = true;
|
| 42 |
+
export let scale: number | null = null;
|
| 43 |
+
export let min_width: number | undefined = undefined;
|
| 44 |
+
export let submit_btn: string | boolean | null = null;
|
| 45 |
+
export let stop_btn: string | boolean | null = null;
|
| 46 |
+
export let loading_status: LoadingStatus | undefined = undefined;
|
| 47 |
+
export let value_is_output = false;
|
| 48 |
+
export let rtl = false;
|
| 49 |
+
export let text_align: "left" | "right" | undefined = undefined;
|
| 50 |
+
export let autofocus = false;
|
| 51 |
+
export let autoscroll = true;
|
| 52 |
+
export let interactive: boolean;
|
| 53 |
+
export let root: string;
|
| 54 |
+
export let file_count: "single" | "multiple" | "directory";
|
| 55 |
+
|
| 56 |
+
let dragging: boolean;
|
| 57 |
+
</script>
|
| 58 |
+
|
| 59 |
+
<Block
|
| 60 |
+
{visible}
|
| 61 |
+
{elem_id}
|
| 62 |
+
elem_classes={[...elem_classes, "multimodal-textbox"]}
|
| 63 |
+
{scale}
|
| 64 |
+
{min_width}
|
| 65 |
+
allow_overflow={false}
|
| 66 |
+
padding={container}
|
| 67 |
+
border_mode={dragging ? "focus" : "base"}
|
| 68 |
+
>
|
| 69 |
+
{#if loading_status}
|
| 70 |
+
<StatusTracker
|
| 71 |
+
autoscroll={gradio.autoscroll}
|
| 72 |
+
i18n={gradio.i18n}
|
| 73 |
+
{...loading_status}
|
| 74 |
+
on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
|
| 75 |
+
/>
|
| 76 |
+
{/if}
|
| 77 |
+
|
| 78 |
+
<MultimodalTextbox
|
| 79 |
+
bind:value
|
| 80 |
+
bind:value_is_output
|
| 81 |
+
bind:dragging
|
| 82 |
+
{file_types}
|
| 83 |
+
{root}
|
| 84 |
+
{label}
|
| 85 |
+
{info}
|
| 86 |
+
{show_label}
|
| 87 |
+
{lines}
|
| 88 |
+
{rtl}
|
| 89 |
+
{text_align}
|
| 90 |
+
max_lines={!max_lines ? lines + 1 : max_lines}
|
| 91 |
+
{placeholder}
|
| 92 |
+
{submit_btn}
|
| 93 |
+
{stop_btn}
|
| 94 |
+
{autofocus}
|
| 95 |
+
{container}
|
| 96 |
+
{autoscroll}
|
| 97 |
+
{file_count}
|
| 98 |
+
max_file_size={gradio.max_file_size}
|
| 99 |
+
on:change={() => gradio.dispatch("change", value)}
|
| 100 |
+
on:input={() => gradio.dispatch("input")}
|
| 101 |
+
on:submit={() => gradio.dispatch("submit")}
|
| 102 |
+
on:stop={() => gradio.dispatch("stop")}
|
| 103 |
+
on:blur={() => gradio.dispatch("blur")}
|
| 104 |
+
on:select={(e) => gradio.dispatch("select", e.detail)}
|
| 105 |
+
on:focus={() => gradio.dispatch("focus")}
|
| 106 |
+
on:error={({ detail }) => {
|
| 107 |
+
gradio.dispatch("error", detail);
|
| 108 |
+
}}
|
| 109 |
+
disabled={!interactive}
|
| 110 |
+
upload={(...args) => gradio.client.upload(...args)}
|
| 111 |
+
stream_handler={(...args) => gradio.client.stream(...args)}
|
| 112 |
+
/>
|
| 113 |
+
</Block>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/multimodaltextbox/shared/utils.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { tick } from "svelte";
|
| 2 |
+
|
| 3 |
+
interface Value {
|
| 4 |
+
lines: number;
|
| 5 |
+
max_lines: number;
|
| 6 |
+
text: string;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export async function resize(
|
| 10 |
+
target: HTMLTextAreaElement | HTMLInputElement,
|
| 11 |
+
lines: number,
|
| 12 |
+
max_lines: number
|
| 13 |
+
): Promise<void> {
|
| 14 |
+
await tick();
|
| 15 |
+
if (lines === max_lines) return;
|
| 16 |
+
|
| 17 |
+
const computed_styles = window.getComputedStyle(target);
|
| 18 |
+
const padding_top = parseFloat(computed_styles.paddingTop);
|
| 19 |
+
const padding_bottom = parseFloat(computed_styles.paddingBottom);
|
| 20 |
+
const line_height = parseFloat(computed_styles.lineHeight);
|
| 21 |
+
|
| 22 |
+
let max =
|
| 23 |
+
max_lines === undefined
|
| 24 |
+
? false
|
| 25 |
+
: padding_top + padding_bottom + line_height * max_lines;
|
| 26 |
+
let min = padding_top + padding_bottom + lines * line_height;
|
| 27 |
+
|
| 28 |
+
target.style.height = "1px";
|
| 29 |
+
|
| 30 |
+
let scroll_height;
|
| 31 |
+
if (max && target.scrollHeight > max) {
|
| 32 |
+
scroll_height = max;
|
| 33 |
+
} else if (target.scrollHeight < min) {
|
| 34 |
+
scroll_height = min;
|
| 35 |
+
} else {
|
| 36 |
+
scroll_height = target.scrollHeight;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
target.style.height = `${scroll_height}px`;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
export function text_area_resize(
|
| 43 |
+
_el: HTMLTextAreaElement,
|
| 44 |
+
_value: Value
|
| 45 |
+
): any | undefined {
|
| 46 |
+
if (_value.lines === _value.max_lines) return;
|
| 47 |
+
_el.style.overflowY = "scroll";
|
| 48 |
+
|
| 49 |
+
function handle_input(event: Event): void {
|
| 50 |
+
resize(event.target as HTMLTextAreaElement, _value.lines, _value.max_lines);
|
| 51 |
+
}
|
| 52 |
+
_el.addEventListener("input", handle_input);
|
| 53 |
+
|
| 54 |
+
if (!_value.text.trim()) return;
|
| 55 |
+
resize(_el, _value.lines, _value.max_lines);
|
| 56 |
+
|
| 57 |
+
return {
|
| 58 |
+
destroy: () => _el.removeEventListener("input", handle_input)
|
| 59 |
+
};
|
| 60 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/Example.svelte
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
>
|
| 12 |
+
<pre>{JSON.stringify(value, null, 2)}</pre>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<style>
|
| 16 |
+
.gallery {
|
| 17 |
+
padding: var(--size-1) var(--size-2);
|
| 18 |
+
}
|
| 19 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/Index.svelte
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import ParamViewer from "./ParamViewer.svelte";
|
| 3 |
+
|
| 4 |
+
export let value: Record<
|
| 5 |
+
string,
|
| 6 |
+
{
|
| 7 |
+
type: string;
|
| 8 |
+
description: string;
|
| 9 |
+
default: string;
|
| 10 |
+
}
|
| 11 |
+
>;
|
| 12 |
+
|
| 13 |
+
export let linkify: string[] = [];
|
| 14 |
+
export let header: string | null = null;
|
| 15 |
+
</script>
|
| 16 |
+
|
| 17 |
+
<ParamViewer docs={value} {linkify} {header} />
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/ParamViewer.svelte
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import "./prism.css";
|
| 3 |
+
|
| 4 |
+
import Prism from "prismjs";
|
| 5 |
+
import "prismjs/components/prism-python";
|
| 6 |
+
import "prismjs/components/prism-typescript";
|
| 7 |
+
|
| 8 |
+
interface Param {
|
| 9 |
+
type: string | null;
|
| 10 |
+
description: string;
|
| 11 |
+
default: string | null;
|
| 12 |
+
name?: string;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export let docs: Record<string, Param>;
|
| 16 |
+
export let lang: "python" | "typescript" = "python";
|
| 17 |
+
export let linkify: string[] = [];
|
| 18 |
+
export let header: string | null;
|
| 19 |
+
|
| 20 |
+
let component_root: HTMLElement;
|
| 21 |
+
let _docs: Param[];
|
| 22 |
+
let all_open = false;
|
| 23 |
+
|
| 24 |
+
$: _docs = highlight_code(docs, lang);
|
| 25 |
+
|
| 26 |
+
function highlight(code: string, lang: "python" | "typescript"): string {
|
| 27 |
+
let highlighted = Prism.highlight(code, Prism.languages[lang], lang);
|
| 28 |
+
|
| 29 |
+
for (const link of linkify) {
|
| 30 |
+
highlighted = highlighted.replace(
|
| 31 |
+
new RegExp(link, "g"),
|
| 32 |
+
`<a href="#h-${link.toLocaleLowerCase()}">${link}</a>`
|
| 33 |
+
);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
return highlighted;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
function highlight_code(
|
| 40 |
+
_docs: typeof docs,
|
| 41 |
+
lang: "python" | "typescript"
|
| 42 |
+
): Param[] {
|
| 43 |
+
if (!_docs) {
|
| 44 |
+
return [];
|
| 45 |
+
}
|
| 46 |
+
return Object.entries(_docs).map(
|
| 47 |
+
([name, { type, description, default: _default }]) => {
|
| 48 |
+
let highlighted_type = type ? highlight(type, lang) : null;
|
| 49 |
+
|
| 50 |
+
return {
|
| 51 |
+
name: name,
|
| 52 |
+
type: highlighted_type,
|
| 53 |
+
description: description,
|
| 54 |
+
default: _default ? highlight(_default, lang) : null
|
| 55 |
+
};
|
| 56 |
+
}
|
| 57 |
+
);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
function toggle_all(): void {
|
| 61 |
+
all_open = !all_open;
|
| 62 |
+
const details = component_root.querySelectorAll(".param");
|
| 63 |
+
details.forEach((detail) => {
|
| 64 |
+
if (detail instanceof HTMLDetailsElement) {
|
| 65 |
+
detail.open = all_open;
|
| 66 |
+
}
|
| 67 |
+
});
|
| 68 |
+
}
|
| 69 |
+
</script>
|
| 70 |
+
|
| 71 |
+
<div class="wrap" bind:this={component_root}>
|
| 72 |
+
{#if header !== null}
|
| 73 |
+
<div class="header">
|
| 74 |
+
<span class="title">{header}</span>
|
| 75 |
+
<button
|
| 76 |
+
class="toggle-all"
|
| 77 |
+
on:click={toggle_all}
|
| 78 |
+
title={all_open ? "Close All" : "Open All"}
|
| 79 |
+
>
|
| 80 |
+
▼
|
| 81 |
+
</button>
|
| 82 |
+
</div>
|
| 83 |
+
{/if}
|
| 84 |
+
{#if _docs}
|
| 85 |
+
{#each _docs as { type, description, default: _default, name } (name)}
|
| 86 |
+
<details class="param md">
|
| 87 |
+
<summary class="type">
|
| 88 |
+
<pre class="language-{lang}"><code
|
| 89 |
+
>{name}{#if type}: {@html type}{/if}</code
|
| 90 |
+
></pre>
|
| 91 |
+
</summary>
|
| 92 |
+
{#if _default}
|
| 93 |
+
<div class="default" class:last={!description}>
|
| 94 |
+
<span style:padding-right={"4px"}>default</span>
|
| 95 |
+
<code>= {@html _default}</code>
|
| 96 |
+
</div>
|
| 97 |
+
{/if}
|
| 98 |
+
{#if description}
|
| 99 |
+
<div class="description"><p>{description}</p></div>
|
| 100 |
+
{/if}
|
| 101 |
+
</details>
|
| 102 |
+
{/each}
|
| 103 |
+
{/if}
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<style>
|
| 107 |
+
.header {
|
| 108 |
+
display: flex;
|
| 109 |
+
justify-content: space-between;
|
| 110 |
+
align-items: center;
|
| 111 |
+
padding: 0.7rem 1rem;
|
| 112 |
+
border-bottom: 1px solid var(--table-border-color);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.title {
|
| 116 |
+
font-size: var(--scale-0);
|
| 117 |
+
font-weight: 600;
|
| 118 |
+
color: var(--body-text-color);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.toggle-all {
|
| 122 |
+
background: none;
|
| 123 |
+
border: none;
|
| 124 |
+
cursor: pointer;
|
| 125 |
+
padding: 0;
|
| 126 |
+
color: var(--body-text-color);
|
| 127 |
+
font-size: 0.7em;
|
| 128 |
+
line-height: 1;
|
| 129 |
+
opacity: 0.7;
|
| 130 |
+
transition:
|
| 131 |
+
opacity 0.2s ease,
|
| 132 |
+
transform 0.3s ease;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.toggle-all:hover {
|
| 136 |
+
opacity: 1;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
:global(.wrap[data-all-open="true"]) .toggle-all {
|
| 140 |
+
transform: rotate(180deg);
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.default :global(pre),
|
| 144 |
+
.default :global(.highlight) {
|
| 145 |
+
display: inline-block;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.wrap :global(pre),
|
| 149 |
+
.wrap :global(.highlight) {
|
| 150 |
+
margin: 0 !important;
|
| 151 |
+
background: transparent !important;
|
| 152 |
+
font-family: var(--font-mono);
|
| 153 |
+
font-weight: 400;
|
| 154 |
+
padding: 0 !important;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.wrap :global(pre a) {
|
| 158 |
+
color: var(--link-text-color-hover);
|
| 159 |
+
text-decoration: underline;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.wrap :global(pre a:hover) {
|
| 163 |
+
color: var(--link-text-color-hover);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
.default > span {
|
| 167 |
+
text-transform: uppercase;
|
| 168 |
+
font-size: 0.7rem;
|
| 169 |
+
font-weight: 600;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
.default > code {
|
| 173 |
+
border: none;
|
| 174 |
+
}
|
| 175 |
+
code {
|
| 176 |
+
background: none;
|
| 177 |
+
font-family: var(--font-mono);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.wrap {
|
| 181 |
+
padding: 0rem;
|
| 182 |
+
border-radius: 5px;
|
| 183 |
+
border: 1px solid #eee;
|
| 184 |
+
overflow: hidden;
|
| 185 |
+
position: relative;
|
| 186 |
+
margin: 0;
|
| 187 |
+
box-shadow: var(--block-shadow);
|
| 188 |
+
border-width: var(--block-border-width);
|
| 189 |
+
border-color: var(--block-border-color);
|
| 190 |
+
border-radius: var(--block-radius);
|
| 191 |
+
width: 100%;
|
| 192 |
+
line-height: var(--line-sm);
|
| 193 |
+
color: var(--body-text-color);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.type {
|
| 197 |
+
position: relative;
|
| 198 |
+
padding: 0.7rem 1rem;
|
| 199 |
+
background: var(--table-odd-background-fill);
|
| 200 |
+
border-bottom: 0px solid var(--table-border-color);
|
| 201 |
+
list-style: none;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
.type::after {
|
| 205 |
+
content: "▼";
|
| 206 |
+
position: absolute;
|
| 207 |
+
top: 50%;
|
| 208 |
+
right: 15px;
|
| 209 |
+
transform: translateY(-50%);
|
| 210 |
+
transition: transform 0.3s ease;
|
| 211 |
+
font-size: 0.7em;
|
| 212 |
+
opacity: 0.7;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
details[open] .type::after {
|
| 216 |
+
transform: translateY(-50%) rotate(180deg);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
.default {
|
| 220 |
+
padding: 0.2rem 1rem 0.3rem 1rem;
|
| 221 |
+
border-bottom: 1px solid var(--table-border-color);
|
| 222 |
+
background: var(--block-background-fill);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.default.last {
|
| 226 |
+
border-bottom: none;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
.description {
|
| 230 |
+
padding: 0.7rem 1rem;
|
| 231 |
+
font-size: var(--scale-00);
|
| 232 |
+
font-family: var(--font-sans);
|
| 233 |
+
background: var(--block-background-fill);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
.param {
|
| 237 |
+
border-bottom: 1px solid var(--table-border-color);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.param:last-child {
|
| 241 |
+
border-bottom: none;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
details[open] .type {
|
| 245 |
+
border-bottom-width: 1px;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
.param.md code {
|
| 249 |
+
background: none;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
details > summary {
|
| 253 |
+
cursor: pointer;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
details > summary::-webkit-details-marker {
|
| 257 |
+
display: none;
|
| 258 |
+
}
|
| 259 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/paramviewer",
|
| 3 |
+
"version": "0.5.1",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"exports": {
|
| 11 |
+
".": {
|
| 12 |
+
"gradio": "./Index.svelte",
|
| 13 |
+
"svelte": "./dist/Index.svelte",
|
| 14 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 15 |
+
},
|
| 16 |
+
"./example": {
|
| 17 |
+
"gradio": "./Example.svelte",
|
| 18 |
+
"svelte": "./dist/Example.svelte",
|
| 19 |
+
"types": "./dist/Example.svelte.d.ts"
|
| 20 |
+
},
|
| 21 |
+
"./package.json": "./package.json"
|
| 22 |
+
},
|
| 23 |
+
"dependencies": {
|
| 24 |
+
"@gradio/atoms": "workspace:^",
|
| 25 |
+
"@gradio/statustracker": "workspace:^",
|
| 26 |
+
"@gradio/utils": "workspace:^",
|
| 27 |
+
"prismjs": "^1.29.0"
|
| 28 |
+
},
|
| 29 |
+
"devDependencies": {
|
| 30 |
+
"@types/prismjs": "^1.26.3",
|
| 31 |
+
"@gradio/preview": "workspace:^"
|
| 32 |
+
},
|
| 33 |
+
"peerDependencies": {
|
| 34 |
+
"svelte": "^4.0.0"
|
| 35 |
+
},
|
| 36 |
+
"repository": {
|
| 37 |
+
"type": "git",
|
| 38 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 39 |
+
"directory": "js/paramviewer"
|
| 40 |
+
}
|
| 41 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/paramviewer/prism.css
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Tables */ table,
|
| 2 |
+
tr,
|
| 3 |
+
td,
|
| 4 |
+
th {
|
| 5 |
+
margin-top: var(--spacing-sm);
|
| 6 |
+
margin-bottom: var(--spacing-sm);
|
| 7 |
+
padding: var(--spacing-xl);
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
/* .message-wrap :global(pre[class*="language-"]),
|
| 11 |
+
.message-wrap :global(pre) {
|
| 12 |
+
border: none;
|
| 13 |
+
background: none;
|
| 14 |
+
position: relative;
|
| 15 |
+
direction: ltr;
|
| 16 |
+
white-space: no-wrap;
|
| 17 |
+
overflow-x: auto;
|
| 18 |
+
}
|
| 19 |
+
.message-wrap :global(code) {
|
| 20 |
+
} */
|
| 21 |
+
|
| 22 |
+
/* .message-wrap :global(div[class*="code_wrap"]) {
|
| 23 |
+
|
| 24 |
+
} */
|
| 25 |
+
|
| 26 |
+
.md code,
|
| 27 |
+
.md pre {
|
| 28 |
+
background: none;
|
| 29 |
+
font-family: var(--font-mono);
|
| 30 |
+
font-size: var(--text-md);
|
| 31 |
+
|
| 32 |
+
text-align: left;
|
| 33 |
+
white-space: pre;
|
| 34 |
+
word-spacing: normal;
|
| 35 |
+
word-break: normal;
|
| 36 |
+
word-wrap: normal;
|
| 37 |
+
line-height: 1.5;
|
| 38 |
+
tab-size: 2;
|
| 39 |
+
|
| 40 |
+
hyphens: none;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.md pre[class*="language-"]::-moz-selection,
|
| 44 |
+
.md pre[class*="language-"] ::-moz-selection,
|
| 45 |
+
.md code[class*="language-"]::-moz-selection,
|
| 46 |
+
.md code[class*="language-"] ::-moz-selection {
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.md pre[class*="language-"]::selection,
|
| 50 |
+
.md pre[class*="language-"] ::selection,
|
| 51 |
+
.md code[class*="language-"]::selection,
|
| 52 |
+
.md code[class*="language-"] ::selection {
|
| 53 |
+
text-shadow: none;
|
| 54 |
+
background: #b3d4fc;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/* Code blocks */
|
| 58 |
+
.md pre {
|
| 59 |
+
padding: 1em;
|
| 60 |
+
margin: 0.5em 0;
|
| 61 |
+
overflow: auto;
|
| 62 |
+
position: relative;
|
| 63 |
+
margin-top: var(--spacing-sm);
|
| 64 |
+
margin-bottom: var(--spacing-sm);
|
| 65 |
+
box-shadow: none;
|
| 66 |
+
border: none;
|
| 67 |
+
border-radius: var(--radius-md);
|
| 68 |
+
background: var(--code-background-fill);
|
| 69 |
+
font-family: var(--font-mono);
|
| 70 |
+
display: block;
|
| 71 |
+
white-space: pre;
|
| 72 |
+
border-radius: var(--radius-sm);
|
| 73 |
+
text-shadow: none;
|
| 74 |
+
border-radius: var(--radius-sm);
|
| 75 |
+
/* font-size: 85%; */
|
| 76 |
+
white-space: nowrap;
|
| 77 |
+
display: block;
|
| 78 |
+
white-space: pre;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.prose code {
|
| 82 |
+
}
|
| 83 |
+
.prose pre > code {
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/* Inline code */
|
| 87 |
+
.md :not(pre) > code {
|
| 88 |
+
padding: 0.1em;
|
| 89 |
+
border-radius: var(--radius-xs);
|
| 90 |
+
white-space: normal;
|
| 91 |
+
background: var(--code-background-fill);
|
| 92 |
+
border: 1px solid var(--panel-border-color);
|
| 93 |
+
padding: var(--spacing-xxs) var(--spacing-xs);
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.md .token.comment,
|
| 97 |
+
.md .token.prolog,
|
| 98 |
+
.md .token.doctype,
|
| 99 |
+
.md .token.cdata {
|
| 100 |
+
color: slategray;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.md .token.punctuation {
|
| 104 |
+
color: #999;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.md .token.namespace {
|
| 108 |
+
opacity: 0.7;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.md .token.property,
|
| 112 |
+
.md .token.tag,
|
| 113 |
+
.md .token.boolean,
|
| 114 |
+
.md .token.number,
|
| 115 |
+
.md .token.constant,
|
| 116 |
+
.md .token.symbol,
|
| 117 |
+
.md .token.deleted {
|
| 118 |
+
color: #905;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.md .token.selector,
|
| 122 |
+
.md .token.attr-name,
|
| 123 |
+
.md .token.string,
|
| 124 |
+
.md .token.char,
|
| 125 |
+
.md .token.builtin,
|
| 126 |
+
.md .token.inserted {
|
| 127 |
+
color: #690;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.md .token.atrule,
|
| 131 |
+
.md .token.attr-value,
|
| 132 |
+
.md .token.keyword {
|
| 133 |
+
color: #07a;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.md .token.function,
|
| 137 |
+
.md .token.class-name {
|
| 138 |
+
color: #dd4a68;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.md .token.regex,
|
| 142 |
+
.md .token.important,
|
| 143 |
+
.md .token.variable {
|
| 144 |
+
color: #e90;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.md .token.important,
|
| 148 |
+
.md .token.bold {
|
| 149 |
+
font-weight: bold;
|
| 150 |
+
}
|
| 151 |
+
.md .token.italic {
|
| 152 |
+
font-style: italic;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.md .token.entity {
|
| 156 |
+
cursor: help;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.dark .md .token.comment,
|
| 160 |
+
.dark .md .token.prolog,
|
| 161 |
+
.dark .md .token.cdata {
|
| 162 |
+
color: hsl(220, 10%, 40%);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.dark .md .token.doctype,
|
| 166 |
+
.dark .md .token.punctuation,
|
| 167 |
+
.dark .md .token.entity {
|
| 168 |
+
color: hsl(220, 14%, 71%);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.dark .md .token.attr-name,
|
| 172 |
+
.dark .md .token.class-name,
|
| 173 |
+
.dark .md .token.boolean,
|
| 174 |
+
.dark .md .token.constant,
|
| 175 |
+
.dark .md .token.number,
|
| 176 |
+
.dark .md .token.atrule {
|
| 177 |
+
color: hsl(29, 54%, 61%);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.dark .md .token.keyword {
|
| 181 |
+
color: hsl(286, 60%, 67%);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.dark .md .token.property,
|
| 185 |
+
.dark .md .token.tag,
|
| 186 |
+
.dark .md .token.symbol,
|
| 187 |
+
.dark .md .token.deleted,
|
| 188 |
+
.dark .md .token.important {
|
| 189 |
+
color: hsl(355, 65%, 65%);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.dark .md .token.selector,
|
| 193 |
+
.dark .md .token.string,
|
| 194 |
+
.dark .md .token.char,
|
| 195 |
+
.dark .md .token.builtin,
|
| 196 |
+
.dark .md .token.inserted,
|
| 197 |
+
.dark .md .token.regex,
|
| 198 |
+
.dark .md .token.attr-value,
|
| 199 |
+
.dark .md .token.attr-value > .token.punctuation {
|
| 200 |
+
color: hsl(95, 38%, 62%);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
.dark .md .token.variable,
|
| 204 |
+
.dark .md .token.operator,
|
| 205 |
+
.dark .md .token.function {
|
| 206 |
+
color: hsl(207, 82%, 66%);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.dark .md .token.url {
|
| 210 |
+
color: hsl(187, 47%, 55%);
|
| 211 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/Index.svelte
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script context="module" lang="ts">
|
| 2 |
+
export { default as BaseTabItem } from "./shared/TabItem.svelte";
|
| 3 |
+
</script>
|
| 4 |
+
|
| 5 |
+
<script lang="ts">
|
| 6 |
+
import type { Gradio, SelectData } from "@gradio/utils";
|
| 7 |
+
import TabItem from "./shared/TabItem.svelte";
|
| 8 |
+
|
| 9 |
+
export let elem_id = "";
|
| 10 |
+
export let elem_classes: string[] = [];
|
| 11 |
+
export let label: string;
|
| 12 |
+
export let id: string | number;
|
| 13 |
+
export let gradio: Gradio<{
|
| 14 |
+
select: SelectData;
|
| 15 |
+
}>;
|
| 16 |
+
export let visible = true;
|
| 17 |
+
export let interactive = true;
|
| 18 |
+
</script>
|
| 19 |
+
|
| 20 |
+
<TabItem
|
| 21 |
+
{elem_id}
|
| 22 |
+
{elem_classes}
|
| 23 |
+
name={label}
|
| 24 |
+
{visible}
|
| 25 |
+
{interactive}
|
| 26 |
+
{id}
|
| 27 |
+
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
| 28 |
+
>
|
| 29 |
+
<slot />
|
| 30 |
+
</TabItem>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/tabitem",
|
| 3 |
+
"version": "0.3.0",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"main_changeset": true,
|
| 10 |
+
"exports": {
|
| 11 |
+
".": {
|
| 12 |
+
"gradio": "./Index.svelte",
|
| 13 |
+
"svelte": "./dist/Index.svelte",
|
| 14 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 15 |
+
},
|
| 16 |
+
"./package.json": "./package.json"
|
| 17 |
+
},
|
| 18 |
+
"dependencies": {
|
| 19 |
+
"@gradio/column": "workspace:^",
|
| 20 |
+
"@gradio/tabs": "workspace:^",
|
| 21 |
+
"@gradio/utils": "workspace:^"
|
| 22 |
+
},
|
| 23 |
+
"devDependencies": {
|
| 24 |
+
"@gradio/preview": "workspace:^"
|
| 25 |
+
},
|
| 26 |
+
"peerDependencies": {
|
| 27 |
+
"svelte": "^4.0.0"
|
| 28 |
+
},
|
| 29 |
+
"repository": {
|
| 30 |
+
"type": "git",
|
| 31 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 32 |
+
"directory": "js/tabitem"
|
| 33 |
+
}
|
| 34 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/_frontend_code/tabitem/shared/TabItem.svelte
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { getContext, onMount, createEventDispatcher, tick } from "svelte";
|
| 3 |
+
import { TABS } from "@gradio/tabs";
|
| 4 |
+
import Column from "@gradio/column";
|
| 5 |
+
import type { SelectData } from "@gradio/utils";
|
| 6 |
+
|
| 7 |
+
export let elem_id = "";
|
| 8 |
+
export let elem_classes: string[] = [];
|
| 9 |
+
export let name: string;
|
| 10 |
+
export let id: string | number | object = {};
|
| 11 |
+
export let visible: boolean;
|
| 12 |
+
export let interactive: boolean;
|
| 13 |
+
|
| 14 |
+
const dispatch = createEventDispatcher<{ select: SelectData }>();
|
| 15 |
+
|
| 16 |
+
const { register_tab, unregister_tab, selected_tab, selected_tab_index } =
|
| 17 |
+
getContext(TABS) as any;
|
| 18 |
+
|
| 19 |
+
let tab_index: number;
|
| 20 |
+
|
| 21 |
+
$: tab_index = register_tab({ name, id, elem_id, visible, interactive });
|
| 22 |
+
|
| 23 |
+
onMount(() => {
|
| 24 |
+
return (): void => unregister_tab({ name, id, elem_id });
|
| 25 |
+
});
|
| 26 |
+
|
| 27 |
+
$: $selected_tab_index === tab_index &&
|
| 28 |
+
tick().then(() => dispatch("select", { value: name, index: tab_index }));
|
| 29 |
+
</script>
|
| 30 |
+
|
| 31 |
+
<div
|
| 32 |
+
id={elem_id}
|
| 33 |
+
class="tabitem {elem_classes.join(' ')}"
|
| 34 |
+
style:display={$selected_tab === id && visible ? "block" : "none"}
|
| 35 |
+
role="tabpanel"
|
| 36 |
+
>
|
| 37 |
+
<Column>
|
| 38 |
+
<slot />
|
| 39 |
+
</Column>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<style>
|
| 43 |
+
div {
|
| 44 |
+
display: flex;
|
| 45 |
+
position: relative;
|
| 46 |
+
border: none;
|
| 47 |
+
border-radius: var(--radius-sm);
|
| 48 |
+
padding: var(--block-padding);
|
| 49 |
+
width: 100%;
|
| 50 |
+
box-sizing: border-box;
|
| 51 |
+
}
|
| 52 |
+
</style>
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (478 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/accordion.cpython-310.pyc
ADDED
|
Binary file (1.94 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/form.cpython-310.pyc
ADDED
|
Binary file (2.13 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/__pycache__/tabs.cpython-310.pyc
ADDED
|
Binary file (4.19 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/accordion.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
from gradio_client.documentation import document
|
| 6 |
+
|
| 7 |
+
from gradio.blocks import BlockContext
|
| 8 |
+
from gradio.component_meta import ComponentMeta
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@document()
|
| 15 |
+
class Accordion(BlockContext, metaclass=ComponentMeta):
|
| 16 |
+
"""
|
| 17 |
+
Accordion is a layout element which can be toggled to show/hide the contained content.
|
| 18 |
+
Example:
|
| 19 |
+
with gr.Accordion("See Details"):
|
| 20 |
+
gr.Markdown("lorem ipsum")
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
EVENTS = []
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
label: str | None = None,
|
| 28 |
+
*,
|
| 29 |
+
open: bool = True,
|
| 30 |
+
visible: bool = True,
|
| 31 |
+
elem_id: str | None = None,
|
| 32 |
+
elem_classes: list[str] | str | None = None,
|
| 33 |
+
render: bool = True,
|
| 34 |
+
):
|
| 35 |
+
"""
|
| 36 |
+
Parameters:
|
| 37 |
+
label: name of accordion section.
|
| 38 |
+
open: if True, accordion is open by default.
|
| 39 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 40 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 41 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 42 |
+
"""
|
| 43 |
+
self.label = label
|
| 44 |
+
self.open = open
|
| 45 |
+
BlockContext.__init__(
|
| 46 |
+
self,
|
| 47 |
+
visible=visible,
|
| 48 |
+
elem_id=elem_id,
|
| 49 |
+
elem_classes=elem_classes,
|
| 50 |
+
render=render,
|
| 51 |
+
)
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/column.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import warnings
|
| 4 |
+
from typing import Literal
|
| 5 |
+
|
| 6 |
+
from gradio_client.documentation import document
|
| 7 |
+
|
| 8 |
+
from gradio.blocks import BlockContext
|
| 9 |
+
from gradio.component_meta import ComponentMeta
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@document()
|
| 13 |
+
class Column(BlockContext, metaclass=ComponentMeta):
|
| 14 |
+
"""
|
| 15 |
+
Column is a layout element within Blocks that renders all children vertically. The widths of columns can be set through the `scale` and `min_width` parameters.
|
| 16 |
+
If a certain scale results in a column narrower than min_width, the min_width parameter will win.
|
| 17 |
+
Example:
|
| 18 |
+
with gr.Blocks() as demo:
|
| 19 |
+
with gr.Row():
|
| 20 |
+
with gr.Column(scale=1):
|
| 21 |
+
text1 = gr.Textbox()
|
| 22 |
+
text2 = gr.Textbox()
|
| 23 |
+
with gr.Column(scale=4):
|
| 24 |
+
btn1 = gr.Button("Button 1")
|
| 25 |
+
btn2 = gr.Button("Button 2")
|
| 26 |
+
Guides: controlling-layout
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
EVENTS = []
|
| 30 |
+
|
| 31 |
+
def __init__(
|
| 32 |
+
self,
|
| 33 |
+
*,
|
| 34 |
+
scale: int = 1,
|
| 35 |
+
min_width: int = 320,
|
| 36 |
+
variant: Literal["default", "panel", "compact"] = "default",
|
| 37 |
+
visible: bool = True,
|
| 38 |
+
elem_id: str | None = None,
|
| 39 |
+
elem_classes: list[str] | str | None = None,
|
| 40 |
+
render: bool = True,
|
| 41 |
+
show_progress: bool = False,
|
| 42 |
+
):
|
| 43 |
+
"""
|
| 44 |
+
Parameters:
|
| 45 |
+
scale: relative width compared to adjacent Columns. For example, if Column A has scale=2, and Column B has scale=1, A will be twice as wide as B.
|
| 46 |
+
min_width: minimum pixel width of Column, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in a column narrower than min_width, the min_width parameter will be respected first.
|
| 47 |
+
variant: column type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
|
| 48 |
+
visible: If False, column will be hidden.
|
| 49 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 50 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 51 |
+
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.
|
| 52 |
+
show_progress: If True, shows progress animation when being updated.
|
| 53 |
+
"""
|
| 54 |
+
if scale != round(scale):
|
| 55 |
+
warnings.warn(
|
| 56 |
+
f"'scale' value should be an integer. Using {scale} will cause issues."
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
self.scale = scale
|
| 60 |
+
self.min_width = min_width
|
| 61 |
+
self.variant = variant
|
| 62 |
+
if variant == "compact":
|
| 63 |
+
self.allow_expected_parents = False
|
| 64 |
+
self.show_progress = show_progress
|
| 65 |
+
BlockContext.__init__(
|
| 66 |
+
self,
|
| 67 |
+
visible=visible,
|
| 68 |
+
elem_id=elem_id,
|
| 69 |
+
elem_classes=elem_classes,
|
| 70 |
+
render=render,
|
| 71 |
+
)
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/column.pyi
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import warnings
|
| 4 |
+
from typing import Literal
|
| 5 |
+
|
| 6 |
+
from gradio_client.documentation import document
|
| 7 |
+
|
| 8 |
+
from gradio.blocks import BlockContext
|
| 9 |
+
from gradio.component_meta import ComponentMeta
|
| 10 |
+
|
| 11 |
+
from gradio.events import Dependency
|
| 12 |
+
|
| 13 |
+
@document()
|
| 14 |
+
class Column(BlockContext, metaclass=ComponentMeta):
|
| 15 |
+
"""
|
| 16 |
+
Column is a layout element within Blocks that renders all children vertically. The widths of columns can be set through the `scale` and `min_width` parameters.
|
| 17 |
+
If a certain scale results in a column narrower than min_width, the min_width parameter will win.
|
| 18 |
+
Example:
|
| 19 |
+
with gr.Blocks() as demo:
|
| 20 |
+
with gr.Row():
|
| 21 |
+
with gr.Column(scale=1):
|
| 22 |
+
text1 = gr.Textbox()
|
| 23 |
+
text2 = gr.Textbox()
|
| 24 |
+
with gr.Column(scale=4):
|
| 25 |
+
btn1 = gr.Button("Button 1")
|
| 26 |
+
btn2 = gr.Button("Button 2")
|
| 27 |
+
Guides: controlling-layout
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
EVENTS = []
|
| 31 |
+
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
*,
|
| 35 |
+
scale: int = 1,
|
| 36 |
+
min_width: int = 320,
|
| 37 |
+
variant: Literal["default", "panel", "compact"] = "default",
|
| 38 |
+
visible: bool = True,
|
| 39 |
+
elem_id: str | None = None,
|
| 40 |
+
elem_classes: list[str] | str | None = None,
|
| 41 |
+
render: bool = True,
|
| 42 |
+
show_progress: bool = False,
|
| 43 |
+
):
|
| 44 |
+
"""
|
| 45 |
+
Parameters:
|
| 46 |
+
scale: relative width compared to adjacent Columns. For example, if Column A has scale=2, and Column B has scale=1, A will be twice as wide as B.
|
| 47 |
+
min_width: minimum pixel width of Column, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in a column narrower than min_width, the min_width parameter will be respected first.
|
| 48 |
+
variant: column type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
|
| 49 |
+
visible: If False, column will be hidden.
|
| 50 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 51 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 52 |
+
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.
|
| 53 |
+
show_progress: If True, shows progress animation when being updated.
|
| 54 |
+
"""
|
| 55 |
+
if scale != round(scale):
|
| 56 |
+
warnings.warn(
|
| 57 |
+
f"'scale' value should be an integer. Using {scale} will cause issues."
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
self.scale = scale
|
| 61 |
+
self.min_width = min_width
|
| 62 |
+
self.variant = variant
|
| 63 |
+
if variant == "compact":
|
| 64 |
+
self.allow_expected_parents = False
|
| 65 |
+
self.show_progress = show_progress
|
| 66 |
+
BlockContext.__init__(
|
| 67 |
+
self,
|
| 68 |
+
visible=visible,
|
| 69 |
+
elem_id=elem_id,
|
| 70 |
+
elem_classes=elem_classes,
|
| 71 |
+
render=render,
|
| 72 |
+
)
|
| 73 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 74 |
+
from gradio.blocks import Block
|
| 75 |
+
if TYPE_CHECKING:
|
| 76 |
+
from gradio.components import Timer
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/form.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
from gradio.blocks import BlockContext, Blocks
|
| 6 |
+
from gradio.component_meta import ComponentMeta
|
| 7 |
+
from gradio.layouts.column import Column
|
| 8 |
+
from gradio.layouts.row import Row
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from gradio.blocks import Block
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class Form(BlockContext, metaclass=ComponentMeta):
|
| 15 |
+
EVENTS = []
|
| 16 |
+
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
*,
|
| 20 |
+
scale: int = 0,
|
| 21 |
+
min_width: int = 0,
|
| 22 |
+
render: bool = True,
|
| 23 |
+
):
|
| 24 |
+
"""
|
| 25 |
+
Parameters:
|
| 26 |
+
scale: relative width compared to adjacent Columns. For example, if Column A has scale=2, and Column B has scale=1, A will be twice as wide as B.
|
| 27 |
+
min_width: minimum pixel width of Column, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in a column narrower than min_width, the min_width parameter will be respected first.
|
| 28 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 29 |
+
"""
|
| 30 |
+
self.scale = scale
|
| 31 |
+
self.min_width = min_width
|
| 32 |
+
BlockContext.__init__(
|
| 33 |
+
self,
|
| 34 |
+
render=render,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
def add_child(self, child: Block):
|
| 38 |
+
if isinstance(self.parent, Row):
|
| 39 |
+
scale = getattr(child, "scale", None)
|
| 40 |
+
self.scale += 1 if scale is None else scale
|
| 41 |
+
self.min_width += getattr(child, "min_width", 0) or 0
|
| 42 |
+
elif (
|
| 43 |
+
isinstance(self.parent, Column)
|
| 44 |
+
and isinstance(self.parent.parent, Row)
|
| 45 |
+
and self.parent.parent.equal_height
|
| 46 |
+
):
|
| 47 |
+
scale = getattr(child, "scale", None)
|
| 48 |
+
self.scale += 1 if scale is None else scale
|
| 49 |
+
elif isinstance(self.parent, Blocks) and self.parent.fill_height:
|
| 50 |
+
scale = getattr(child, "scale", None)
|
| 51 |
+
self.scale += 0 if scale is None else scale
|
| 52 |
+
BlockContext.add_child(self, child)
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/group.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from gradio_client.documentation import document
|
| 4 |
+
|
| 5 |
+
from gradio.blocks import BlockContext
|
| 6 |
+
from gradio.component_meta import ComponentMeta
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@document()
|
| 10 |
+
class Group(BlockContext, metaclass=ComponentMeta):
|
| 11 |
+
"""
|
| 12 |
+
Group is a layout element within Blocks which groups together children so that
|
| 13 |
+
they do not have any padding or margin between them.
|
| 14 |
+
Example:
|
| 15 |
+
with gr.Group():
|
| 16 |
+
gr.Textbox(label="First")
|
| 17 |
+
gr.Textbox(label="Last")
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
EVENTS = []
|
| 21 |
+
|
| 22 |
+
def __init__(
|
| 23 |
+
self,
|
| 24 |
+
*,
|
| 25 |
+
visible: bool = True,
|
| 26 |
+
elem_id: str | None = None,
|
| 27 |
+
elem_classes: list[str] | str | None = None,
|
| 28 |
+
render: bool = True,
|
| 29 |
+
):
|
| 30 |
+
"""
|
| 31 |
+
Parameters:
|
| 32 |
+
visible: If False, group will be hidden.
|
| 33 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 34 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 35 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 36 |
+
"""
|
| 37 |
+
BlockContext.__init__(
|
| 38 |
+
self,
|
| 39 |
+
visible=visible,
|
| 40 |
+
elem_id=elem_id,
|
| 41 |
+
elem_classes=elem_classes,
|
| 42 |
+
render=render,
|
| 43 |
+
)
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/row.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Literal
|
| 4 |
+
|
| 5 |
+
from gradio_client.documentation import document
|
| 6 |
+
|
| 7 |
+
from gradio.blocks import BlockContext
|
| 8 |
+
from gradio.component_meta import ComponentMeta
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@document()
|
| 12 |
+
class Row(BlockContext, metaclass=ComponentMeta):
|
| 13 |
+
"""
|
| 14 |
+
Row is a layout element within Blocks that renders all children horizontally.
|
| 15 |
+
Example:
|
| 16 |
+
with gr.Blocks() as demo:
|
| 17 |
+
with gr.Row():
|
| 18 |
+
gr.Image("lion.jpg", scale=2)
|
| 19 |
+
gr.Image("tiger.jpg", scale=1)
|
| 20 |
+
demo.launch()
|
| 21 |
+
Guides: controlling-layout
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
EVENTS = []
|
| 25 |
+
|
| 26 |
+
def __init__(
|
| 27 |
+
self,
|
| 28 |
+
*,
|
| 29 |
+
variant: Literal["default", "panel", "compact"] = "default",
|
| 30 |
+
visible: bool = True,
|
| 31 |
+
elem_id: str | None = None,
|
| 32 |
+
elem_classes: list[str] | str | None = None,
|
| 33 |
+
render: bool = True,
|
| 34 |
+
height: int | str | None = None,
|
| 35 |
+
max_height: int | str | None = None,
|
| 36 |
+
min_height: int | str | None = None,
|
| 37 |
+
equal_height: bool = False,
|
| 38 |
+
show_progress: bool = False,
|
| 39 |
+
):
|
| 40 |
+
"""
|
| 41 |
+
Parameters:
|
| 42 |
+
variant: row type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
|
| 43 |
+
visible: If False, row will be hidden.
|
| 44 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 45 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 46 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 47 |
+
height: The height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will scroll vertically. If not set, the row will expand to fit the content.
|
| 48 |
+
max_height: The maximum height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will scroll vertically. If content is shorter than the height, the row will shrink to fit the content. Will not have any effect if `height` is set and is smaller than `max_height`.
|
| 49 |
+
min_height: The minimum height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will expand to fit the content. Will not have any effect if `height` is set and is larger than `min_height`.
|
| 50 |
+
equal_height: If True, makes every child element have equal height
|
| 51 |
+
show_progress: If True, shows progress animation when being updated.
|
| 52 |
+
"""
|
| 53 |
+
self.variant = variant
|
| 54 |
+
self.equal_height = equal_height
|
| 55 |
+
if variant == "compact":
|
| 56 |
+
self.allow_expected_parents = False
|
| 57 |
+
self.show_progress = show_progress
|
| 58 |
+
self.height = height
|
| 59 |
+
self.max_height = max_height
|
| 60 |
+
self.min_height = min_height
|
| 61 |
+
|
| 62 |
+
BlockContext.__init__(
|
| 63 |
+
self,
|
| 64 |
+
visible=visible,
|
| 65 |
+
elem_id=elem_id,
|
| 66 |
+
elem_classes=elem_classes,
|
| 67 |
+
render=render,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
@staticmethod
|
| 71 |
+
def update(
|
| 72 |
+
visible: bool | None = None,
|
| 73 |
+
):
|
| 74 |
+
return {
|
| 75 |
+
"visible": visible,
|
| 76 |
+
"__type__": "update",
|
| 77 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/row.pyi
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Literal
|
| 4 |
+
|
| 5 |
+
from gradio_client.documentation import document
|
| 6 |
+
|
| 7 |
+
from gradio.blocks import BlockContext
|
| 8 |
+
from gradio.component_meta import ComponentMeta
|
| 9 |
+
|
| 10 |
+
from gradio.events import Dependency
|
| 11 |
+
|
| 12 |
+
@document()
|
| 13 |
+
class Row(BlockContext, metaclass=ComponentMeta):
|
| 14 |
+
"""
|
| 15 |
+
Row is a layout element within Blocks that renders all children horizontally.
|
| 16 |
+
Example:
|
| 17 |
+
with gr.Blocks() as demo:
|
| 18 |
+
with gr.Row():
|
| 19 |
+
gr.Image("lion.jpg", scale=2)
|
| 20 |
+
gr.Image("tiger.jpg", scale=1)
|
| 21 |
+
demo.launch()
|
| 22 |
+
Guides: controlling-layout
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
EVENTS = []
|
| 26 |
+
|
| 27 |
+
def __init__(
|
| 28 |
+
self,
|
| 29 |
+
*,
|
| 30 |
+
variant: Literal["default", "panel", "compact"] = "default",
|
| 31 |
+
visible: bool = True,
|
| 32 |
+
elem_id: str | None = None,
|
| 33 |
+
elem_classes: list[str] | str | None = None,
|
| 34 |
+
render: bool = True,
|
| 35 |
+
height: int | str | None = None,
|
| 36 |
+
max_height: int | str | None = None,
|
| 37 |
+
min_height: int | str | None = None,
|
| 38 |
+
equal_height: bool = False,
|
| 39 |
+
show_progress: bool = False,
|
| 40 |
+
):
|
| 41 |
+
"""
|
| 42 |
+
Parameters:
|
| 43 |
+
variant: row type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
|
| 44 |
+
visible: If False, row will be hidden.
|
| 45 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 46 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 47 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 48 |
+
height: The height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will scroll vertically. If not set, the row will expand to fit the content.
|
| 49 |
+
max_height: The maximum height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will scroll vertically. If content is shorter than the height, the row will shrink to fit the content. Will not have any effect if `height` is set and is smaller than `max_height`.
|
| 50 |
+
min_height: The minimum height of the row, specified in pixels if a number is passed, or in CSS units if a string is passed. If content exceeds the height, the row will expand to fit the content. Will not have any effect if `height` is set and is larger than `min_height`.
|
| 51 |
+
equal_height: If True, makes every child element have equal height
|
| 52 |
+
show_progress: If True, shows progress animation when being updated.
|
| 53 |
+
"""
|
| 54 |
+
self.variant = variant
|
| 55 |
+
self.equal_height = equal_height
|
| 56 |
+
if variant == "compact":
|
| 57 |
+
self.allow_expected_parents = False
|
| 58 |
+
self.show_progress = show_progress
|
| 59 |
+
self.height = height
|
| 60 |
+
self.max_height = max_height
|
| 61 |
+
self.min_height = min_height
|
| 62 |
+
|
| 63 |
+
BlockContext.__init__(
|
| 64 |
+
self,
|
| 65 |
+
visible=visible,
|
| 66 |
+
elem_id=elem_id,
|
| 67 |
+
elem_classes=elem_classes,
|
| 68 |
+
render=render,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
@staticmethod
|
| 72 |
+
def update(
|
| 73 |
+
visible: bool | None = None,
|
| 74 |
+
):
|
| 75 |
+
return {
|
| 76 |
+
"visible": visible,
|
| 77 |
+
"__type__": "update",
|
| 78 |
+
}
|
| 79 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 80 |
+
from gradio.blocks import Block
|
| 81 |
+
if TYPE_CHECKING:
|
| 82 |
+
from gradio.components import Timer
|
evalkit_tf437/lib/python3.10/site-packages/gradio/layouts/tabs.pyi
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from gradio_client.documentation import document
|
| 4 |
+
|
| 5 |
+
from gradio.blocks import BlockContext
|
| 6 |
+
from gradio.component_meta import ComponentMeta
|
| 7 |
+
from gradio.events import Events
|
| 8 |
+
|
| 9 |
+
from gradio.events import Dependency
|
| 10 |
+
|
| 11 |
+
class Tabs(BlockContext, metaclass=ComponentMeta):
|
| 12 |
+
"""
|
| 13 |
+
Tabs is a layout element within Blocks that can contain multiple "Tab" Components.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
EVENTS = [Events.change, Events.select]
|
| 17 |
+
|
| 18 |
+
def __init__(
|
| 19 |
+
self,
|
| 20 |
+
*,
|
| 21 |
+
selected: int | str | None = None,
|
| 22 |
+
visible: bool = True,
|
| 23 |
+
elem_id: str | None = None,
|
| 24 |
+
elem_classes: list[str] | str | None = None,
|
| 25 |
+
render: bool = True,
|
| 26 |
+
):
|
| 27 |
+
"""
|
| 28 |
+
Parameters:
|
| 29 |
+
selected: The currently selected tab. Must correspond to an id passed to the one of the child TabItems. Defaults to the first TabItem.
|
| 30 |
+
visible: If False, Tabs will be hidden.
|
| 31 |
+
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 32 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 33 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 34 |
+
"""
|
| 35 |
+
BlockContext.__init__(
|
| 36 |
+
self,
|
| 37 |
+
visible=visible,
|
| 38 |
+
elem_id=elem_id,
|
| 39 |
+
elem_classes=elem_classes,
|
| 40 |
+
render=render,
|
| 41 |
+
)
|
| 42 |
+
self.selected = selected
|
| 43 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 44 |
+
from gradio.blocks import Block
|
| 45 |
+
if TYPE_CHECKING:
|
| 46 |
+
from gradio.components import Timer
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def change(self,
|
| 50 |
+
fn: Callable[..., Any] | None = None,
|
| 51 |
+
inputs: Block | Sequence[Block] | set[Block] | None = None,
|
| 52 |
+
outputs: Block | Sequence[Block] | None = None,
|
| 53 |
+
api_name: str | None | Literal[False] = None,
|
| 54 |
+
scroll_to_output: bool = False,
|
| 55 |
+
show_progress: Literal["full", "minimal", "hidden"] = "full",
|
| 56 |
+
queue: bool | None = None,
|
| 57 |
+
batch: bool = False,
|
| 58 |
+
max_batch_size: int = 4,
|
| 59 |
+
preprocess: bool = True,
|
| 60 |
+
postprocess: bool = True,
|
| 61 |
+
cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
|
| 62 |
+
every: Timer | float | None = None,
|
| 63 |
+
trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
|
| 64 |
+
js: str | None = None,
|
| 65 |
+
concurrency_limit: int | None | Literal["default"] = "default",
|
| 66 |
+
concurrency_id: str | None = None,
|
| 67 |
+
show_api: bool = True,
|
| 68 |
+
|
| 69 |
+
) -> Dependency:
|
| 70 |
+
"""
|
| 71 |
+
Parameters:
|
| 72 |
+
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
|
| 73 |
+
inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
|
| 74 |
+
outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
|
| 75 |
+
api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
|
| 76 |
+
scroll_to_output: if True, will scroll to output component on completion
|
| 77 |
+
show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
|
| 78 |
+
queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
|
| 79 |
+
batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
|
| 80 |
+
max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
|
| 81 |
+
preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
|
| 82 |
+
postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
|
| 83 |
+
cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
|
| 84 |
+
every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
|
| 85 |
+
trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
|
| 86 |
+
js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
|
| 87 |
+
concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
|
| 88 |
+
concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
|
| 89 |
+
show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
|
| 90 |
+
|
| 91 |
+
"""
|
| 92 |
+
...
|
| 93 |
+
|
| 94 |
+
def select(self,
|
| 95 |
+
fn: Callable[..., Any] | None = None,
|
| 96 |
+
inputs: Block | Sequence[Block] | set[Block] | None = None,
|
| 97 |
+
outputs: Block | Sequence[Block] | None = None,
|
| 98 |
+
api_name: str | None | Literal[False] = None,
|
| 99 |
+
scroll_to_output: bool = False,
|
| 100 |
+
show_progress: Literal["full", "minimal", "hidden"] = "full",
|
| 101 |
+
queue: bool | None = None,
|
| 102 |
+
batch: bool = False,
|
| 103 |
+
max_batch_size: int = 4,
|
| 104 |
+
preprocess: bool = True,
|
| 105 |
+
postprocess: bool = True,
|
| 106 |
+
cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
|
| 107 |
+
every: Timer | float | None = None,
|
| 108 |
+
trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
|
| 109 |
+
js: str | None = None,
|
| 110 |
+
concurrency_limit: int | None | Literal["default"] = "default",
|
| 111 |
+
concurrency_id: str | None = None,
|
| 112 |
+
show_api: bool = True,
|
| 113 |
+
|
| 114 |
+
) -> Dependency:
|
| 115 |
+
"""
|
| 116 |
+
Parameters:
|
| 117 |
+
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
|
| 118 |
+
inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
|
| 119 |
+
outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
|
| 120 |
+
api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
|
| 121 |
+
scroll_to_output: if True, will scroll to output component on completion
|
| 122 |
+
show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
|
| 123 |
+
queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
|
| 124 |
+
batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
|
| 125 |
+
max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
|
| 126 |
+
preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
|
| 127 |
+
postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
|
| 128 |
+
cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
|
| 129 |
+
every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
|
| 130 |
+
trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
|
| 131 |
+
js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
|
| 132 |
+
concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
|
| 133 |
+
concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
|
| 134 |
+
show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
|
| 135 |
+
|
| 136 |
+
"""
|
| 137 |
+
...
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
@document()
|
| 141 |
+
class Tab(BlockContext, metaclass=ComponentMeta):
|
| 142 |
+
"""
|
| 143 |
+
Tab (or its alias TabItem) is a layout element. Components defined within the Tab will be visible when this tab is selected tab.
|
| 144 |
+
Example:
|
| 145 |
+
with gr.Blocks() as demo:
|
| 146 |
+
with gr.Tab("Lion"):
|
| 147 |
+
gr.Image("lion.jpg")
|
| 148 |
+
gr.Button("New Lion")
|
| 149 |
+
with gr.Tab("Tiger"):
|
| 150 |
+
gr.Image("tiger.jpg")
|
| 151 |
+
gr.Button("New Tiger")
|
| 152 |
+
Guides: controlling-layout
|
| 153 |
+
"""
|
| 154 |
+
|
| 155 |
+
EVENTS = [Events.select]
|
| 156 |
+
|
| 157 |
+
def __init__(
|
| 158 |
+
self,
|
| 159 |
+
label: str | None = None,
|
| 160 |
+
visible: bool = True,
|
| 161 |
+
interactive: bool = True,
|
| 162 |
+
*,
|
| 163 |
+
id: int | str | None = None,
|
| 164 |
+
elem_id: str | None = None,
|
| 165 |
+
elem_classes: list[str] | str | None = None,
|
| 166 |
+
render: bool = True,
|
| 167 |
+
):
|
| 168 |
+
"""
|
| 169 |
+
Parameters:
|
| 170 |
+
label: The visual label for the tab
|
| 171 |
+
id: An optional identifier for the tab, required if you wish to control the selected tab from a predict function.
|
| 172 |
+
elem_id: An optional string that is assigned as the id of the <div> containing the contents of the Tab layout. The same string followed by "-button" is attached to the Tab button. Can be used for targeting CSS styles.
|
| 173 |
+
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
|
| 174 |
+
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
| 175 |
+
visible: If False, Tab will be hidden.
|
| 176 |
+
interactive: If False, Tab will not be clickable.
|
| 177 |
+
"""
|
| 178 |
+
BlockContext.__init__(
|
| 179 |
+
self,
|
| 180 |
+
elem_id=elem_id,
|
| 181 |
+
elem_classes=elem_classes,
|
| 182 |
+
render=render,
|
| 183 |
+
)
|
| 184 |
+
self.label = label
|
| 185 |
+
self.id = id
|
| 186 |
+
self.visible = visible
|
| 187 |
+
self.interactive = interactive
|
| 188 |
+
|
| 189 |
+
def get_expected_parent(self) -> type[Tabs]:
|
| 190 |
+
return Tabs
|
| 191 |
+
|
| 192 |
+
def get_block_name(self):
|
| 193 |
+
return "tabitem"
|
| 194 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 195 |
+
from gradio.blocks import Block
|
| 196 |
+
if TYPE_CHECKING:
|
| 197 |
+
from gradio.components import Timer
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
def select(self,
|
| 201 |
+
fn: Callable[..., Any] | None = None,
|
| 202 |
+
inputs: Block | Sequence[Block] | set[Block] | None = None,
|
| 203 |
+
outputs: Block | Sequence[Block] | None = None,
|
| 204 |
+
api_name: str | None | Literal[False] = None,
|
| 205 |
+
scroll_to_output: bool = False,
|
| 206 |
+
show_progress: Literal["full", "minimal", "hidden"] = "full",
|
| 207 |
+
queue: bool | None = None,
|
| 208 |
+
batch: bool = False,
|
| 209 |
+
max_batch_size: int = 4,
|
| 210 |
+
preprocess: bool = True,
|
| 211 |
+
postprocess: bool = True,
|
| 212 |
+
cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
|
| 213 |
+
every: Timer | float | None = None,
|
| 214 |
+
trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
|
| 215 |
+
js: str | None = None,
|
| 216 |
+
concurrency_limit: int | None | Literal["default"] = "default",
|
| 217 |
+
concurrency_id: str | None = None,
|
| 218 |
+
show_api: bool = True,
|
| 219 |
+
|
| 220 |
+
) -> Dependency:
|
| 221 |
+
"""
|
| 222 |
+
Parameters:
|
| 223 |
+
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
|
| 224 |
+
inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
|
| 225 |
+
outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
|
| 226 |
+
api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
|
| 227 |
+
scroll_to_output: if True, will scroll to output component on completion
|
| 228 |
+
show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
|
| 229 |
+
queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
|
| 230 |
+
batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
|
| 231 |
+
max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
|
| 232 |
+
preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
|
| 233 |
+
postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
|
| 234 |
+
cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
|
| 235 |
+
every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
|
| 236 |
+
trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
|
| 237 |
+
js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
|
| 238 |
+
concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
|
| 239 |
+
concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
|
| 240 |
+
show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
|
| 241 |
+
|
| 242 |
+
"""
|
| 243 |
+
...
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
TabItem = Tab
|
evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Example.Ce2XkglX.js.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fbe21d4781d9fc216e2e81ee375b6a53f63c8ba89c9d3d8d43acaa9d6289a954
|
| 3 |
+
size 818
|
evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Gallery.HXgWnEV3.js.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79928e08b0ab7d2e4bbf6b8a078147124c99f1f0273f4ec017c1deb098028358
|
| 3 |
+
size 10165
|
evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/IconButtonWrapper.y99hkeYc.js.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5401684dc6676e53e9c33939523ffcb284824ffdec894f8b464e25159ffeff38
|
| 3 |
+
size 1009
|