-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
normalise audio + video input data types
- Loading branch information
Showing
27 changed files
with
109 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,39 @@ | ||
<script lang="ts"> | ||
import { Audio } from "@gradio/audio"; | ||
import type { FileData } from "@gradio/upload"; | ||
import { normalise_file } from "@gradio/upload"; | ||
export let mode: "static" | "dynamic"; | ||
export let value: null | FileData | string = null; | ||
export let theme: string; | ||
export let default_value: null | FileData | string = null; | ||
export let style: string | null; | ||
export let name: string; | ||
export let source: "microphone" | "upload"; | ||
export let type: "normal" | "numpy" = "normal"; | ||
export let label: string; | ||
if (default_value) value = default_value; | ||
let _value: null | FileData; | ||
$: _value = normalise_file(value); | ||
</script> | ||
|
||
{#if mode === "dynamic"} | ||
<Audio | ||
{value} | ||
{theme} | ||
{label} | ||
value={_value} | ||
on:change={({ detail }) => (value = detail)} | ||
{style} | ||
{name} | ||
{source} | ||
{type} | ||
on:change={({ detail }) => (value = detail)} | ||
on:edit | ||
on:play | ||
on:pause | ||
on:ended | ||
/> | ||
{:else if value} | ||
<audio {theme} {style} controls> | ||
<source src={typeof value === "string" ? value : value.data} /> | ||
{:else if _value} | ||
<audio {style} controls> | ||
<source src={_value.data} /> | ||
</audio> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
<script lang="ts"> | ||
import { File, FileUpload } from "@gradio/file"; | ||
import type { FileData } from "@gradio/upload"; | ||
import { normalise_file } from "@gradio/upload"; | ||
export let value: null | FileData = null; | ||
export let default_value: null | FileData = null; | ||
export let theme: string; | ||
export let style: string | null; | ||
export let style: string = ""; | ||
export let mode: "static" | "dynamic"; | ||
if (default_value) value = default_value; | ||
let _value: null | FileData; | ||
$: _value = normalise_file(value); | ||
</script> | ||
|
||
{#if mode === "dynamic"} | ||
<FileUpload bind:value {theme} {style} on:change on:clear /> | ||
{:else if value} | ||
<File {value} {theme} {style} /> | ||
<FileUpload | ||
value={_value} | ||
on:change={({ detail }) => (value = detail)} | ||
{style} | ||
on:change | ||
on:clear | ||
/> | ||
{:else if _value} | ||
<File value={_value} {theme} {style} /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.