@gradio/core 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/blocks.d.ts +1 -0
- package/dist/blocks.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/login.d.ts +1 -0
- package/dist/login.js +1 -0
- package/dist/src/Blocks.svelte +671 -0
- package/dist/src/Blocks.svelte.d.ts +41 -0
- package/dist/src/Embed.svelte +195 -0
- package/dist/src/Embed.svelte.d.ts +26 -0
- package/dist/src/Login.svelte +107 -0
- package/dist/src/Login.svelte.d.ts +19 -0
- package/dist/src/MountComponents.svelte +26 -0
- package/dist/src/MountComponents.svelte.d.ts +26 -0
- package/dist/src/Render.svelte +91 -0
- package/dist/src/Render.svelte.d.ts +29 -0
- package/dist/src/RenderComponent.svelte +51 -0
- package/dist/src/RenderComponent.svelte.d.ts +32 -0
- package/dist/src/api_docs/ApiBanner.svelte +115 -0
- package/dist/src/api_docs/ApiBanner.svelte.d.ts +19 -0
- package/dist/src/api_docs/ApiDocs.svelte +388 -0
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +27 -0
- package/dist/src/api_docs/ApiRecorder.svelte +72 -0
- package/dist/src/api_docs/ApiRecorder.svelte.d.ts +18 -0
- package/dist/src/api_docs/CodeSnippet.svelte +184 -0
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +24 -0
- package/dist/src/api_docs/CopyButton.svelte +15 -0
- package/dist/src/api_docs/CopyButton.svelte.d.ts +16 -0
- package/dist/src/api_docs/EndpointDetail.svelte +36 -0
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +18 -0
- package/dist/src/api_docs/InputPayload.svelte +149 -0
- package/dist/src/api_docs/InputPayload.svelte.d.ts +24 -0
- package/dist/src/api_docs/InstallSnippet.svelte +56 -0
- package/dist/src/api_docs/InstallSnippet.svelte.d.ts +16 -0
- package/dist/src/api_docs/NoApi.svelte +71 -0
- package/dist/src/api_docs/NoApi.svelte.d.ts +18 -0
- package/dist/src/api_docs/ParametersSnippet.svelte +104 -0
- package/dist/src/api_docs/ParametersSnippet.svelte.d.ts +19 -0
- package/dist/src/api_docs/RecordingSnippet.svelte +210 -0
- package/dist/src/api_docs/RecordingSnippet.svelte.d.ts +22 -0
- package/dist/src/api_docs/ResponseSnippet.svelte +95 -0
- package/dist/src/api_docs/ResponseSnippet.svelte.d.ts +19 -0
- package/dist/src/api_docs/TryButton.svelte +17 -0
- package/dist/src/api_docs/TryButton.svelte.d.ts +17 -0
- package/dist/src/api_docs/img/api-logo.svg +4 -0
- package/dist/src/api_docs/img/bash.svg +8 -0
- package/dist/src/api_docs/img/clear.svelte +19 -0
- package/dist/src/api_docs/img/clear.svelte.d.ts +23 -0
- package/dist/src/api_docs/img/javascript.svg +16 -0
- package/dist/src/api_docs/img/python.svg +20 -0
- package/dist/src/api_docs/index.d.ts +2 -0
- package/dist/src/api_docs/index.js +2 -0
- package/dist/src/api_docs/utils.d.ts +2 -0
- package/dist/src/api_docs/utils.js +135 -0
- package/dist/src/css.d.ts +2 -0
- package/dist/src/css.js +93 -0
- package/dist/src/gradio_helper.js +4 -0
- package/dist/src/i18n.d.ts +6 -0
- package/dist/src/i18n.js +22 -0
- package/dist/src/images/lightning.svg +2 -0
- package/dist/src/images/logo.svg +19 -0
- package/dist/src/images/play.svg +2 -0
- package/dist/src/images/spaces.svg +7 -0
- package/dist/src/init.d.ts +107 -0
- package/dist/src/init.js +377 -0
- package/dist/src/lang/BCP47_codes.d.ts +2 -0
- package/dist/src/lang/BCP47_codes.js +58 -0
- package/dist/src/lang/ar.json +16 -0
- package/dist/src/lang/ca.json +19 -0
- package/dist/src/lang/ckb.json +108 -0
- package/dist/src/lang/de.json +16 -0
- package/dist/src/lang/en.json +118 -0
- package/dist/src/lang/es.json +17 -0
- package/dist/src/lang/eu.json +16 -0
- package/dist/src/lang/fa.json +16 -0
- package/dist/src/lang/fr.json +30 -0
- package/dist/src/lang/he.json +16 -0
- package/dist/src/lang/hi.json +16 -0
- package/dist/src/lang/ja.json +16 -0
- package/dist/src/lang/ko.json +16 -0
- package/dist/src/lang/lt.json +16 -0
- package/dist/src/lang/nl.json +16 -0
- package/dist/src/lang/pl.json +16 -0
- package/dist/src/lang/pt-BR.json +19 -0
- package/dist/src/lang/ru.json +118 -0
- package/dist/src/lang/ta.json +16 -0
- package/dist/src/lang/tr.json +16 -0
- package/dist/src/lang/uk.json +16 -0
- package/dist/src/lang/ur.json +16 -0
- package/dist/src/lang/uz.json +15 -0
- package/dist/src/lang/zh-CN.json +115 -0
- package/dist/src/lang/zh-TW.json +16 -0
- package/dist/src/s-blocks.d.ts +1 -0
- package/dist/src/s-blocks.js +1 -0
- package/dist/src/s-login.d.ts +1 -0
- package/dist/src/s-login.js +1 -0
- package/dist/src/stores.d.ts +30 -0
- package/dist/src/stores.js +93 -0
- package/dist/src/types.d.ts +95 -0
- package/dist/src/types.js +1 -0
- package/dist/src/vite-env-override.d.ts +20 -0
- package/package.json +71 -60
- package/src/Render.svelte +3 -1
- package/src/api_docs/ApiDocs.svelte +1 -1
- package/src/api_docs/ApiRecorder.svelte +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<script>import CopyButton from "./CopyButton.svelte";
|
|
2
|
+
import { represent_value, is_potentially_nested_file_data } from "./utils";
|
|
3
|
+
import { Block } from "@gradio/atoms";
|
|
4
|
+
import EndpointDetail from "./EndpointDetail.svelte";
|
|
5
|
+
export let dependency;
|
|
6
|
+
export let dependency_index;
|
|
7
|
+
export let root;
|
|
8
|
+
export let space_id;
|
|
9
|
+
export let endpoint_parameters;
|
|
10
|
+
export let named;
|
|
11
|
+
export let username;
|
|
12
|
+
export let current_language;
|
|
13
|
+
let python_code;
|
|
14
|
+
let js_code;
|
|
15
|
+
let bash_post_code;
|
|
16
|
+
let bash_get_code;
|
|
17
|
+
let has_file_path = endpoint_parameters.some(
|
|
18
|
+
(param) => is_potentially_nested_file_data(param.example_input)
|
|
19
|
+
);
|
|
20
|
+
let blob_components = ["Audio", "File", "Image", "Video"];
|
|
21
|
+
let blob_examples = endpoint_parameters.filter(
|
|
22
|
+
(param) => blob_components.includes(param.component)
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class="container">
|
|
27
|
+
{#if named}
|
|
28
|
+
<EndpointDetail {named} api_name={dependency.api_name} />
|
|
29
|
+
{:else}
|
|
30
|
+
<EndpointDetail {named} fn_index={dependency_index} />
|
|
31
|
+
{/if}
|
|
32
|
+
{#if current_language === "python"}
|
|
33
|
+
<Block>
|
|
34
|
+
<code>
|
|
35
|
+
<div class="copy">
|
|
36
|
+
<CopyButton code={python_code?.innerText} />
|
|
37
|
+
</div>
|
|
38
|
+
<div bind:this={python_code}>
|
|
39
|
+
<pre><span class="highlight">from</span> gradio_client <span
|
|
40
|
+
class="highlight">import</span
|
|
41
|
+
> Client{#if has_file_path}, handle_file{/if}
|
|
42
|
+
|
|
43
|
+
client = Client(<span class="token string">"{space_id || root}"</span
|
|
44
|
+
>{#if username !== null}, auth=("{username}", **password**){/if})
|
|
45
|
+
result = client.<span class="highlight">predict</span
|
|
46
|
+
>(<!--
|
|
47
|
+
-->{#each endpoint_parameters as { python_type, example_input, parameter_name, parameter_has_default, parameter_default }, i}<!--
|
|
48
|
+
-->
|
|
49
|
+
{parameter_name
|
|
50
|
+
? parameter_name + "="
|
|
51
|
+
: ""}<span
|
|
52
|
+
>{represent_value(
|
|
53
|
+
parameter_has_default ? parameter_default : example_input,
|
|
54
|
+
python_type.type,
|
|
55
|
+
"py"
|
|
56
|
+
)}</span
|
|
57
|
+
>,{/each}<!--
|
|
58
|
+
|
|
59
|
+
-->
|
|
60
|
+
api_name=<span class="api-name">"/{dependency.api_name}"</span><!--
|
|
61
|
+
-->
|
|
62
|
+
)
|
|
63
|
+
<span class="highlight">print</span>(result)</pre>
|
|
64
|
+
</div>
|
|
65
|
+
</code>
|
|
66
|
+
</Block>
|
|
67
|
+
{:else if current_language === "javascript"}
|
|
68
|
+
<Block>
|
|
69
|
+
<code>
|
|
70
|
+
<div class="copy">
|
|
71
|
+
<CopyButton code={js_code?.innerText} />
|
|
72
|
+
</div>
|
|
73
|
+
<div bind:this={js_code}>
|
|
74
|
+
<pre>import { Client } from "@gradio/client";
|
|
75
|
+
{#each blob_examples as { component, example_input }, i}<!--
|
|
76
|
+
-->
|
|
77
|
+
const response_{i} = await fetch("{example_input.url}");
|
|
78
|
+
const example{component} = await response_{i}.blob();
|
|
79
|
+
{/each}<!--
|
|
80
|
+
-->
|
|
81
|
+
const client = await Client.connect(<span class="token string"
|
|
82
|
+
>"{space_id || root}"</span
|
|
83
|
+
>{#if username !== null}, {auth: ["{username}", **password**]}{/if});
|
|
84
|
+
const result = await client.predict({#if named}<span class="api-name"
|
|
85
|
+
>"/{dependency.api_name}"</span
|
|
86
|
+
>{:else}{dependency_index}{/if}, { <!--
|
|
87
|
+
-->{#each endpoint_parameters as { label, parameter_name, type, python_type, component, example_input, serializer }, i}<!--
|
|
88
|
+
-->{#if blob_components.includes(component)}<!--
|
|
89
|
+
-->
|
|
90
|
+
<span
|
|
91
|
+
class="example-inputs"
|
|
92
|
+
>{parameter_name}: example{component}</span
|
|
93
|
+
>, <!--
|
|
94
|
+
--><span class="desc"><!--
|
|
95
|
+
--></span
|
|
96
|
+
><!--
|
|
97
|
+
-->{:else}<!--
|
|
98
|
+
-->
|
|
99
|
+
<span class="example-inputs"
|
|
100
|
+
>{parameter_name}: {represent_value(
|
|
101
|
+
example_input,
|
|
102
|
+
python_type.type,
|
|
103
|
+
"js"
|
|
104
|
+
)}</span
|
|
105
|
+
>, <!--
|
|
106
|
+
--><!--
|
|
107
|
+
-->{/if}
|
|
108
|
+
{/each}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
console.log(result.data);
|
|
112
|
+
</pre>
|
|
113
|
+
</div>
|
|
114
|
+
</code>
|
|
115
|
+
</Block>
|
|
116
|
+
{:else if current_language === "bash"}
|
|
117
|
+
<Block>
|
|
118
|
+
<code>
|
|
119
|
+
<div class="copy">
|
|
120
|
+
<CopyButton code={bash_post_code?.innerText}></CopyButton>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div bind:this={bash_post_code}>
|
|
124
|
+
<pre>curl -X POST {root}call/{dependency.api_name} -s -H "Content-Type: application/json" -d '{"{"}
|
|
125
|
+
"data": [{#each endpoint_parameters as { label, parameter_name, type, python_type, component, example_input, serializer }, i}
|
|
126
|
+
<!--
|
|
127
|
+
-->{represent_value(
|
|
128
|
+
example_input,
|
|
129
|
+
python_type.type,
|
|
130
|
+
"bash"
|
|
131
|
+
)}{#if i < endpoint_parameters.length - 1},
|
|
132
|
+
{/if}
|
|
133
|
+
{/each}
|
|
134
|
+
]{"}"}' \
|
|
135
|
+
| awk -F'"' '{"{"} print $4{"}"}' \
|
|
136
|
+
| read EVENT_ID; curl -N {root}call/{dependency.api_name}/$EVENT_ID</pre>
|
|
137
|
+
</div>
|
|
138
|
+
</code>
|
|
139
|
+
</Block>
|
|
140
|
+
{/if}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<style>
|
|
144
|
+
code pre {
|
|
145
|
+
overflow-x: auto;
|
|
146
|
+
color: var(--body-text-color);
|
|
147
|
+
font-family: var(--font-mono);
|
|
148
|
+
tab-size: 2;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.token.string {
|
|
152
|
+
display: contents;
|
|
153
|
+
color: var(--color-accent-base);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
code {
|
|
157
|
+
position: relative;
|
|
158
|
+
display: block;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.copy {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 0;
|
|
164
|
+
right: 0;
|
|
165
|
+
margin-top: -5px;
|
|
166
|
+
margin-right: -5px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.container {
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
gap: var(--spacing-xxl);
|
|
173
|
+
margin-top: var(--size-3);
|
|
174
|
+
margin-bottom: var(--size-3);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.desc {
|
|
178
|
+
color: var(--body-text-color-subdued);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.api-name {
|
|
182
|
+
color: var(--color-accent);
|
|
183
|
+
}
|
|
184
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Dependency } from "../types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
dependency: Dependency;
|
|
6
|
+
dependency_index: number;
|
|
7
|
+
root: string;
|
|
8
|
+
space_id: string | null;
|
|
9
|
+
endpoint_parameters: any;
|
|
10
|
+
named: boolean;
|
|
11
|
+
username: string | null;
|
|
12
|
+
current_language: "python" | "javascript" | "bash";
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type CodeSnippetProps = typeof __propDef.props;
|
|
20
|
+
export type CodeSnippetEvents = typeof __propDef.events;
|
|
21
|
+
export type CodeSnippetSlots = typeof __propDef.slots;
|
|
22
|
+
export default class CodeSnippet extends SvelteComponent<CodeSnippetProps, CodeSnippetEvents, CodeSnippetSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script>import { BaseButton } from "@gradio/button";
|
|
2
|
+
export let code;
|
|
3
|
+
let copy_text = "copy";
|
|
4
|
+
function copy() {
|
|
5
|
+
navigator.clipboard.writeText(code);
|
|
6
|
+
copy_text = "copied!";
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
copy_text = "copy";
|
|
9
|
+
}, 1500);
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<BaseButton size="sm" on:click={copy}>
|
|
14
|
+
{copy_text}
|
|
15
|
+
</BaseButton>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type CopyButtonProps = typeof __propDef.props;
|
|
12
|
+
export type CopyButtonEvents = typeof __propDef.events;
|
|
13
|
+
export type CopyButtonSlots = typeof __propDef.slots;
|
|
14
|
+
export default class CopyButton extends SvelteComponent<CopyButtonProps, CopyButtonEvents, CopyButtonSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>export let api_name = null;
|
|
2
|
+
export let fn_index = null;
|
|
3
|
+
export let named;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if named}
|
|
7
|
+
<h3>
|
|
8
|
+
api_name:
|
|
9
|
+
<span class="post">{"/" + api_name}</span>
|
|
10
|
+
</h3>
|
|
11
|
+
{:else}
|
|
12
|
+
<h3>
|
|
13
|
+
fn_index:
|
|
14
|
+
<span class="post">{fn_index}</span>
|
|
15
|
+
</h3>
|
|
16
|
+
{/if}
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
h3 {
|
|
20
|
+
color: var(--body-text-color);
|
|
21
|
+
font-weight: var(--section-header-text-weight);
|
|
22
|
+
font-size: var(--text-lg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.post {
|
|
26
|
+
margin-right: var(--size-2);
|
|
27
|
+
border: 1px solid var(--border-color-accent);
|
|
28
|
+
border-radius: var(--radius-sm);
|
|
29
|
+
background: var(--color-accent-soft);
|
|
30
|
+
padding-right: var(--size-1);
|
|
31
|
+
padding-bottom: var(--size-1);
|
|
32
|
+
padding-left: var(--size-1);
|
|
33
|
+
color: var(--color-accent);
|
|
34
|
+
font-weight: var(--weight-semibold);
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
api_name?: (string | null) | undefined;
|
|
5
|
+
fn_index?: (number | null) | undefined;
|
|
6
|
+
named: boolean;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type EndpointDetailProps = typeof __propDef.props;
|
|
14
|
+
export type EndpointDetailEvents = typeof __propDef.events;
|
|
15
|
+
export type EndpointDetailSlots = typeof __propDef.slots;
|
|
16
|
+
export default class EndpointDetail extends SvelteComponent<EndpointDetailProps, EndpointDetailEvents, EndpointDetailSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script>import { BaseButton } from "@gradio/button";
|
|
2
|
+
import { Block } from "@gradio/atoms";
|
|
3
|
+
export let dependency;
|
|
4
|
+
export let dependency_failures;
|
|
5
|
+
export let dependency_index;
|
|
6
|
+
export let instance_map;
|
|
7
|
+
export let run;
|
|
8
|
+
export let dependency_inputs;
|
|
9
|
+
function format_label(label) {
|
|
10
|
+
return label ? "'" + label + "'" : "the";
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<h4>
|
|
15
|
+
<div class="toggle-icon">
|
|
16
|
+
<div class="toggle-dot" />
|
|
17
|
+
</div>
|
|
18
|
+
Input Payload
|
|
19
|
+
</h4>
|
|
20
|
+
<Block>
|
|
21
|
+
<div class="payload-details">
|
|
22
|
+
{
|
|
23
|
+
<div class="first-level">"data": [</div>
|
|
24
|
+
{#each dependency.inputs as component_id, component_index}
|
|
25
|
+
<div class="second-level">
|
|
26
|
+
<input
|
|
27
|
+
class=""
|
|
28
|
+
type="text"
|
|
29
|
+
bind:value={dependency_inputs[dependency_index][component_index]}
|
|
30
|
+
/>
|
|
31
|
+
{#if dependency_failures[dependency_index][component_index]}
|
|
32
|
+
<span class="error">ERROR</span>
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
<span class="type">
|
|
36
|
+
: {instance_map[component_id].documentation?.type?.input_payload ||
|
|
37
|
+
instance_map[component_id].documentation?.type?.payload},
|
|
38
|
+
</span>
|
|
39
|
+
<span class="desc">
|
|
40
|
+
// represents {instance_map[component_id].documentation?.description
|
|
41
|
+
?.input_payload ||
|
|
42
|
+
instance_map[component_id].documentation?.description?.payload} of
|
|
43
|
+
{format_label(instance_map[component_id].props.label)}
|
|
44
|
+
<span class="name">
|
|
45
|
+
{instance_map[component_id].props.name}
|
|
46
|
+
</span>
|
|
47
|
+
component
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
{/each}
|
|
51
|
+
<div class="first-level">]</div>
|
|
52
|
+
}
|
|
53
|
+
</div>
|
|
54
|
+
</Block>
|
|
55
|
+
|
|
56
|
+
<span class="space" />
|
|
57
|
+
<BaseButton variant="primary" on:click={run.bind(null, dependency_index)}>
|
|
58
|
+
Try It Out
|
|
59
|
+
</BaseButton>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
.payload-details {
|
|
63
|
+
font-family: var(--font-mono);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.space {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-basis: 1;
|
|
69
|
+
margin-top: var(--size-4);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
h4 {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
margin-top: var(--size-6);
|
|
76
|
+
margin-bottom: var(--size-3);
|
|
77
|
+
color: var(--body-text-color);
|
|
78
|
+
font-weight: var(--weight-bold);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.toggle-icon {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
margin-right: var(--size-2);
|
|
85
|
+
border-radius: var(--radius-full);
|
|
86
|
+
background: var(--color-grey-300);
|
|
87
|
+
width: 12px;
|
|
88
|
+
height: 4px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.toggle-dot {
|
|
92
|
+
border-radius: var(--radius-full);
|
|
93
|
+
background: var(--color-grey-700);
|
|
94
|
+
width: 6px;
|
|
95
|
+
height: 6px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:global(.dark) .toggle-icon {
|
|
99
|
+
background: var(--color-grey-500);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:global(.dark) .toggle-dot {
|
|
103
|
+
background: var(--color-grey-400);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input[type="text"] {
|
|
107
|
+
--ring-color: transparent;
|
|
108
|
+
margin: var(--size-1) 0;
|
|
109
|
+
outline: none !important;
|
|
110
|
+
box-shadow: var(--input-shadow);
|
|
111
|
+
border: var(--input-border-width) solid var(--input-border-color);
|
|
112
|
+
border-radius: var(--radius-lg);
|
|
113
|
+
background: var(--input-background-fill);
|
|
114
|
+
padding: var(--size-1-5);
|
|
115
|
+
color: var(--body-text-color);
|
|
116
|
+
font-weight: var(--input-text-weight);
|
|
117
|
+
font-size: var(--input-text-size);
|
|
118
|
+
line-height: var(--line-sm);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
input:focus {
|
|
122
|
+
box-shadow: var(--input-shadow-focus);
|
|
123
|
+
border-color: var(--input-border-color-focus);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.error {
|
|
127
|
+
color: var(--error-text-color);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.type {
|
|
131
|
+
color: var(--block-label-text-color);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.desc {
|
|
135
|
+
color: var(--body-text-color-subdued);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.name {
|
|
139
|
+
text-transform: capitalize;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.first-level {
|
|
143
|
+
margin-left: 1rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.second-level {
|
|
147
|
+
margin-left: 2rem;
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ComponentMeta, Dependency } from "../types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
dependency: Dependency;
|
|
6
|
+
dependency_failures: boolean[][];
|
|
7
|
+
dependency_index: number;
|
|
8
|
+
instance_map: {
|
|
9
|
+
[id: number]: ComponentMeta;
|
|
10
|
+
};
|
|
11
|
+
run: (id: number) => Promise<void>;
|
|
12
|
+
dependency_inputs: string[][];
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type InputPayloadProps = typeof __propDef.props;
|
|
20
|
+
export type InputPayloadEvents = typeof __propDef.events;
|
|
21
|
+
export type InputPayloadSlots = typeof __propDef.slots;
|
|
22
|
+
export default class InputPayload extends SvelteComponent<InputPayloadProps, InputPayloadEvents, InputPayloadSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>import CopyButton from "./CopyButton.svelte";
|
|
2
|
+
import { Block } from "@gradio/atoms";
|
|
3
|
+
export let current_language;
|
|
4
|
+
let py_install = "pip install gradio_client";
|
|
5
|
+
let js_install = "npm i -D @gradio/client";
|
|
6
|
+
let bash_install = "curl --version";
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Block border_mode="contrast">
|
|
10
|
+
<code>
|
|
11
|
+
{#if current_language === "python"}
|
|
12
|
+
<div class="copy">
|
|
13
|
+
<CopyButton code={py_install} />
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<pre>$ {py_install}</pre>
|
|
17
|
+
</div>
|
|
18
|
+
{:else if current_language === "javascript"}
|
|
19
|
+
<div class="copy">
|
|
20
|
+
<CopyButton code={js_install} />
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<pre>$ {js_install}</pre>
|
|
24
|
+
</div>
|
|
25
|
+
{:else if current_language === "bash"}
|
|
26
|
+
<div class="copy">
|
|
27
|
+
<CopyButton code={bash_install} />
|
|
28
|
+
</div>
|
|
29
|
+
<div>
|
|
30
|
+
<pre>$ {bash_install}</pre>
|
|
31
|
+
</div>
|
|
32
|
+
{/if}
|
|
33
|
+
</code>
|
|
34
|
+
</Block>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
code pre {
|
|
38
|
+
overflow-x: auto;
|
|
39
|
+
color: var(--body-text-color);
|
|
40
|
+
font-family: var(--font-mono);
|
|
41
|
+
tab-size: 2;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
code {
|
|
45
|
+
position: relative;
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.copy {
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
margin-top: -5px;
|
|
54
|
+
margin-right: -5px;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
current_language: "python" | "javascript" | "bash";
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type InstallSnippetProps = typeof __propDef.props;
|
|
12
|
+
export type InstallSnippetEvents = typeof __propDef.events;
|
|
13
|
+
export type InstallSnippetSlots = typeof __propDef.slots;
|
|
14
|
+
export default class InstallSnippet extends SvelteComponent<InstallSnippetProps, InstallSnippetEvents, InstallSnippetSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import Clear from "./img/clear.svelte";
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
4
|
+
export let root;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="wrap prose">
|
|
8
|
+
<h1>API Docs</h1>
|
|
9
|
+
<p class="attention">
|
|
10
|
+
No API Routes found for
|
|
11
|
+
<code>
|
|
12
|
+
{root}
|
|
13
|
+
</code>
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
To expose an API endpoint of your app in this page, set the <code>
|
|
17
|
+
api_name
|
|
18
|
+
</code>
|
|
19
|
+
parameter of the event listener.
|
|
20
|
+
<br />
|
|
21
|
+
For more information, visit the
|
|
22
|
+
<a href="https://gradio.app/sharing_your_app/#api-page" target="_blank">
|
|
23
|
+
API Page guide
|
|
24
|
+
</a>
|
|
25
|
+
. To hide the API documentation button and this page, set
|
|
26
|
+
<code>show_api=False</code>
|
|
27
|
+
in the
|
|
28
|
+
<code>Blocks.launch()</code>
|
|
29
|
+
method.
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<button on:click={() => dispatch("close")}>
|
|
34
|
+
<Clear />
|
|
35
|
+
</button>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.wrap {
|
|
39
|
+
padding: var(--size-6);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.attention {
|
|
43
|
+
font-weight: var(--weight-bold);
|
|
44
|
+
font-size: var(--text-lg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.attention code {
|
|
48
|
+
border: none;
|
|
49
|
+
background: none;
|
|
50
|
+
color: var(--color-accent);
|
|
51
|
+
font-weight: var(--weight-bold);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
button {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: var(--size-5);
|
|
57
|
+
right: var(--size-6);
|
|
58
|
+
width: var(--size-4);
|
|
59
|
+
color: var(--body-text-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
button:hover {
|
|
63
|
+
color: var(--color-accent);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (--screen-md) {
|
|
67
|
+
button {
|
|
68
|
+
top: var(--size-6);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
root: string;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
close: CustomEvent<any>;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type NoApiProps = typeof __propDef.props;
|
|
14
|
+
export type NoApiEvents = typeof __propDef.events;
|
|
15
|
+
export type NoApiSlots = typeof __propDef.slots;
|
|
16
|
+
export default class NoApi extends SvelteComponent<NoApiProps, NoApiEvents, NoApiSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|