mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
Typeable value on gradio.Slider (#2329)
* typeable number slider * fix hardcoded files in test configs * test * test fix
This commit is contained in:
parent
a05f32c8f1
commit
55e6f40f80
1
.github/workflows/ui.yml
vendored
1
.github/workflows/ui.yml
vendored
@ -54,6 +54,7 @@ jobs:
|
||||
cache: pnpm
|
||||
cache-dependency-path: ui/pnpm-lock.yaml
|
||||
- run: pip install -r ../requirements.txt
|
||||
- run: pip install gradio
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm exec playwright install chromium
|
||||
- run: pnpm build
|
||||
|
@ -164,7 +164,7 @@
|
||||
"headers": [],
|
||||
"samples": [
|
||||
[
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/blocks_inputs/lion.jpg"
|
||||
"lion.jpg"
|
||||
]
|
||||
],
|
||||
"type": "index",
|
||||
|
@ -758,14 +758,14 @@
|
||||
],
|
||||
"baz",
|
||||
"bar",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/titanic.csv",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"world.mp4",
|
||||
"cantina.wav",
|
||||
"cantina.wav",
|
||||
"titanic.csv",
|
||||
[
|
||||
[
|
||||
1,
|
||||
@ -778,7 +778,7 @@
|
||||
5
|
||||
]
|
||||
],
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/time.csv"
|
||||
"time.csv"
|
||||
],
|
||||
[
|
||||
"the quick brown fox",
|
||||
@ -793,14 +793,14 @@
|
||||
],
|
||||
"baz",
|
||||
"bar",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/titanic.csv",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"world.mp4",
|
||||
"cantina.wav",
|
||||
"cantina.wav",
|
||||
"titanic.csv",
|
||||
[
|
||||
[
|
||||
1,
|
||||
@ -813,7 +813,7 @@
|
||||
5
|
||||
]
|
||||
],
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/time.csv"
|
||||
"time.csv"
|
||||
],
|
||||
[
|
||||
"the quick brown fox",
|
||||
@ -828,14 +828,14 @@
|
||||
],
|
||||
"baz",
|
||||
"bar",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav",
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/titanic.csv",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"cheetah1.jpg",
|
||||
"world.mp4",
|
||||
"cantina.wav",
|
||||
"cantina.wav",
|
||||
"titanic.csv",
|
||||
[
|
||||
[
|
||||
1,
|
||||
@ -848,7 +848,7 @@
|
||||
5
|
||||
]
|
||||
],
|
||||
"/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/time.csv"
|
||||
"time.csv"
|
||||
]
|
||||
],
|
||||
"type": "index",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"build:website": "vite build --mode production:website --emptyOutDir",
|
||||
"build:local": "vite build --mode production:local --emptyOutDir",
|
||||
"preview": "vite preview",
|
||||
"test:browser": "pnpm exec python test/create_demo_configs.py && pnpm exec playwright test test/ --config=../../playwright.config.js",
|
||||
"test:browser": "python test/create_demo_configs.py && pnpm exec playwright test test/ --config=../../playwright.config.js",
|
||||
"test:browser:debug": "pnpm exec playwright test test/ --debug --config=../../playwright.config.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -51,7 +51,7 @@ test("test inputs", async ({ page }) => {
|
||||
|
||||
const uploaded_image = await page.locator("img").nth(0);
|
||||
const image_data = await uploaded_image.getAttribute("src");
|
||||
await expect(image_data).toEqual(BASE64_IMAGE);
|
||||
await expect(image_data).toContain("cheetah1.jpg");
|
||||
|
||||
// Image Input w/ Cropper
|
||||
const image_cropper = await page.locator("input").nth(10);
|
||||
@ -59,7 +59,7 @@ test("test inputs", async ({ page }) => {
|
||||
|
||||
const uploaded_image_cropper = await page.locator("img").nth(0);
|
||||
const image_data_cropper = await uploaded_image_cropper.getAttribute("src");
|
||||
await expect(image_data_cropper).toEqual(BASE64_IMAGE);
|
||||
await expect(image_data_cropper).toContain("cheetah1.jpg");
|
||||
});
|
||||
|
||||
test("test outputs", async ({ page }) => {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { BlockTitle } from "@gradio/atoms";
|
||||
import { create_classes } from "@gradio/utils";
|
||||
import { get_styles } from "@gradio/utils";
|
||||
import type { Styles } from "@gradio/utils";
|
||||
|
||||
export let value: number = 0;
|
||||
@ -18,10 +18,10 @@
|
||||
export let show_label: boolean;
|
||||
|
||||
const id = `range_id_${_id++}`;
|
||||
|
||||
const dispatch = createEventDispatcher<{ change: number }>();
|
||||
|
||||
$: dispatch("change", value);
|
||||
$: ({ classes } = get_styles(style, ["rounded", "border"]));
|
||||
</script>
|
||||
|
||||
<div class="w-full flex flex-col ">
|
||||
@ -29,9 +29,15 @@
|
||||
<label for={id}>
|
||||
<BlockTitle {show_label}>{label}</BlockTitle>
|
||||
</label>
|
||||
<div class={"font-medium dark:text-gray-300" + create_classes(style)}>
|
||||
{value}
|
||||
</div>
|
||||
<input
|
||||
type="number"
|
||||
class="gr-box gr-input gr-text-input text-center h-6 {classes}"
|
||||
bind:value
|
||||
min={minimum}
|
||||
max={maximum}
|
||||
{step}
|
||||
{disabled}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user