/
index.svelte
98 lines (94 loc) 路 1.82 KB
/
index.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<svelte:options accessors={true} />
<script lang="ts">
import type { FileData } from "@gradio/upload";
import type { LoadingStatus } from "@gradio/statustracker";
import Audio from "./interactive";
import StaticAudio from "./static";
export let elem_id = "";
export let elem_classes: string[] = [];
export let visible = true;
export let mode: "static" | "interactive";
export let value: null | FileData | string = null;
export let name: string;
export let source: "microphone" | "upload";
export let label: string;
export let root: string;
export let show_label: boolean;
export let pending: boolean;
export let streaming: boolean;
export let root_url: null | string;
export let container = true;
export let scale: number | null = null;
export let min_width: number | undefined = undefined;
export let loading_status: LoadingStatus;
export let autoplay = false;
export let show_download_button = true;
export let show_share_button = false;
export let show_edit_button = true;
</script>
{#if mode === "interactive"}
<Audio
{elem_id}
{elem_classes}
{visible}
bind:value
{name}
{source}
{label}
{root}
{show_label}
{pending}
{streaming}
{root_url}
{container}
{scale}
{min_width}
{loading_status}
{autoplay}
{show_edit_button}
on:change
on:stream
on:drag
on:edit
on:play
on:pause
on:stop
on:end
on:start_recording
on:stop_recording
on:upload
on:error
/>
{:else}
<StaticAudio
{elem_id}
{elem_classes}
{visible}
{mode}
bind:value
{source}
{label}
{root}
{show_label}
{root_url}
{container}
{scale}
{min_width}
{loading_status}
{autoplay}
{show_download_button}
{show_share_button}
on:change
on:stream
on:drag
on:edit
on:play
on:pause
on:stop
on:end
on:start_recording
on:stop_recording
on:upload
on:error
/>
{/if}