mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
parent
df4d9f472f
commit
e828a68c98
@ -268,7 +268,7 @@ class Textbox(Changeable, Submittable, IOComponent):
|
||||
Preprocessing: passes textarea value as a {str} into the function.
|
||||
Postprocessing: expects a {str} returned from function and sets textarea value to it.
|
||||
|
||||
Demos: hello_world, diff_texts, sentence_builder, blocks_gpt
|
||||
Demos: hello_world, diff_texts, sentence_builder
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -473,7 +473,7 @@ class Number(Changeable, Submittable, IOComponent):
|
||||
Preprocessing: passes field value as a {float} or {int} into the function, depending on `precision`.
|
||||
Postprocessing: expects an {int} or {float} returned from the function and sets field value to it.
|
||||
|
||||
Demos: tax_calculator, titanic_survival, blocks_static_textbox, blocks_simple_squares
|
||||
Demos: tax_calculator, titanic_survival, blocks_hello
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -951,7 +951,7 @@ class CheckboxGroup(Changeable, IOComponent):
|
||||
Preprocessing: passes the list of checked checkboxes as a {List[str]} or their indices as a {List[int]} into the function, depending on `type`.
|
||||
Postprocessing: expects a {List[str]}, each element of which becomes a checked checkbox.
|
||||
|
||||
Demos: sentence_builder, titanic_survival, fraud_detector
|
||||
Demos: sentence_builder, titanic_survival
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -1118,7 +1118,7 @@ class Radio(Changeable, IOComponent):
|
||||
Preprocessing: passes the value of the selected radio button as a {str} or its index as an {int} into the function, depending on `type`.
|
||||
Postprocessing: expects a {str} corresponding to the value of the radio button to be selected.
|
||||
|
||||
Demos: sentence_builder, tax_calculator, titanic_survival, blocks_essay
|
||||
Demos: sentence_builder, titanic_survival, blocks_essay
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -1269,7 +1269,7 @@ class Dropdown(Radio):
|
||||
Preprocessing: passes the value of the selected dropdown entry as a {str} or its index as an {int} into the function, depending on `type`.
|
||||
Postprocessing: expects a {str} corresponding to the value of the dropdown entry to be selected.
|
||||
|
||||
Demos: sentence_builder, filter_records, titanic_survival
|
||||
Demos: sentence_builder, titanic_survival
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -1315,7 +1315,7 @@ class Image(Editable, Clearable, Changeable, Streamable, IOComponent):
|
||||
Preprocessing: passes the uploaded image as a {numpy.array}, {PIL.Image} or {str} filepath depending on `type`.
|
||||
Postprocessing: expects a {numpy.array}, {PIL.Image} or {str} filepath to an image and displays the image.
|
||||
|
||||
Demos: image_classifier, image_mod, webcam, digit_classifier
|
||||
Demos: image_mod, blocks_xray, webcam
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -1812,7 +1812,7 @@ class Audio(Changeable, Clearable, Playable, Streamable, IOComponent):
|
||||
Preprocessing: passes the uploaded audio as a {Tuple(int, numpy.array)} corresponding to (sample rate, data) or as a {str} filepath, depending on `type`
|
||||
Postprocessing: expects a {Tuple(int, numpy.array)} corresponding to (sample rate, data) or as a {str} filepath to an audio file, which gets displayed
|
||||
|
||||
Demos: main_note, generate_tone, reverse_audio, spectogram
|
||||
Demos: main_note, generate_tone, reverse_audio
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -2631,7 +2631,7 @@ class Label(Changeable, IOComponent):
|
||||
Preprocessing: this component does *not* accept input.
|
||||
Postprocessing: expects a {Dict[str, float]} of classes and confidences, or {str} with just the class or an {int}/{float} for regression outputs.
|
||||
|
||||
Demos: image_classifier, main_note, titanic_survival
|
||||
Demos: main_note, titanic_survival
|
||||
"""
|
||||
|
||||
CONFIDENCES_KEY = "confidences"
|
||||
@ -3286,7 +3286,6 @@ class Model3D(Changeable, Editable, Clearable, IOComponent):
|
||||
Component creates a 3D Model component with input and output capabilities.
|
||||
Input type: File object of type (.obj, glb, or .gltf)
|
||||
Output type: filepath
|
||||
Demos: model3D
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -3414,7 +3413,7 @@ class Plot(Changeable, Clearable, IOComponent):
|
||||
Preprocessing: this component does *not* accept input.
|
||||
Postprocessing: expects either a {matplotlib.pyplot.Figure}, a {plotly.graph_objects._figure.Figure}, or a {dict} corresponding to a bokeh plot (json_item format)
|
||||
|
||||
Demos: outbreak_forecast, blocks_kinematics, stock_forecast
|
||||
Demos: blocks_kinematics, stock_forecast
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -3490,7 +3489,7 @@ class Markdown(IOComponent, Changeable):
|
||||
Preprocessing: this component does *not* accept input.
|
||||
Postprocessing: expects a valid {str} that can be rendered as Markdown.
|
||||
|
||||
Demos: blocks_hello, blocks_kinematics, blocks_neural_instrument_coding
|
||||
Demos: blocks_hello, blocks_kinematics
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@ -316,6 +316,9 @@
|
||||
function set_status(
|
||||
statuses: Record<number, Omit<LoadingStatus, "outputs">>
|
||||
) {
|
||||
if (window.__gradio_mode__ === "website") {
|
||||
return;
|
||||
}
|
||||
for (const id in statuses) {
|
||||
set_prop(instance_map[id], "loading_status", statuses[id]);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
"scripts": {
|
||||
"prebuild": "(ls ../../gradio/templates/frontend/assets) || (cd ../../ui && pnpm i --frozen-lockfile && pnpm build && cd ../website/homepage) || (npm install pnpm && cd ../../ui && pnpm i --frozen-lockfile && npm install pnpm && pnpm build && cd ../website/homepage)",
|
||||
"build:setup": "mkdir -p dist generated",
|
||||
"build:html": "python render_html.py && html-minifier --input-dir generated --output-dir dist --file-ext html --remove-comments --collapse-whitespace --minify-js true",
|
||||
"build:html": "python render_html.py && html-minifier --input-dir generated --output-dir dist --file-ext html --remove-comments --collapse-whitespace",
|
||||
"build:css": "postcss src/style.css -o dist/style.css && python replace_style_names.py",
|
||||
"build:assets": "cp -R src/assets/. dist/assets/",
|
||||
"build": "npm run prebuild && npm run build:setup && npm run build:html && npm run build:css && npm run build:assets",
|
||||
|
@ -835,23 +835,27 @@
|
||||
.then(demo => {
|
||||
demo.root = demo_endpoint + "/{{ src }}/";
|
||||
launchGradioWhenReady(demo, "#{{ src }}-interface");
|
||||
});
|
||||
}).
|
||||
catch(e => {
|
||||
document.querySelector(".demo-tab[demo='{{ src }}']").remove()
|
||||
})
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
function buildDemos(demo_names) {
|
||||
console.log(demo_names);
|
||||
for (let i = 0; i < demo_names.length; i++) {
|
||||
let demo_name = demo_names[i];
|
||||
if (i == 0) {
|
||||
let demoTab = document.createElement('div');
|
||||
demoTab.classList.add("demo-tab", "mr-2", "border-orange-500", "border-b-2", "text-orange-500", "cursor-pointer");
|
||||
showCode(demo_names[i]);
|
||||
showInterface(demo_names[i])
|
||||
demoTab.innerHTML = demo_names[i];
|
||||
demoTab.setAttribute("demo", demo_name)
|
||||
showCode(demo_name);
|
||||
showInterface(demo_name)
|
||||
demoTab.innerHTML = demo_name;
|
||||
demoTab.onclick = function() {
|
||||
showCode(demo_names[i]);
|
||||
showInterface(demo_names[i])
|
||||
showCode(demo_name);
|
||||
showInterface(demo_name)
|
||||
let otherTabs = document.querySelectorAll(".demo-tab").forEach(e => {
|
||||
e.classList.remove("text-orange-500", "border-orange-500", "border-b-2");
|
||||
e.classList.add("hover:text-gray-800");
|
||||
@ -861,11 +865,12 @@
|
||||
demosNav.appendChild(demoTab);
|
||||
} else {
|
||||
let demoTab = document.createElement('div');
|
||||
demoTab.setAttribute("demo", demo_name)
|
||||
demoTab.classList.add("demo-tab", "mr-2", "cursor-pointer", "hover:text-gray-800");
|
||||
demoTab.innerHTML = demo_names[i];
|
||||
demoTab.innerHTML = demo_name;
|
||||
demoTab.onclick = function() {
|
||||
showCode(demo_names[i]);
|
||||
showInterface(demo_names[i])
|
||||
showCode(demo_name);
|
||||
showInterface(demo_name)
|
||||
let otherTabs = document.querySelectorAll(".demo-tab").forEach(e => {
|
||||
e.classList.remove("text-orange-500", "border-orange-500", "border-b-2");
|
||||
e.classList.add("hover:text-gray-800");
|
||||
|
Loading…
x
Reference in New Issue
Block a user