This commit is contained in:
Ali Abid 2020-07-06 07:29:40 -07:00
parent d8a6baccad
commit d0adaf2a2f
6 changed files with 19 additions and 6 deletions

View File

@ -308,7 +308,10 @@ class Image(AbstractInput):
return array
def process_example(self, example):
return preprocessing_utils.convert_file_to_base64(example)
if os.path.exists(example)
return preprocessing_utils.convert_file_to_base64(example)
else:
return example
class Microphone(AbstractInput):

View File

@ -30,7 +30,7 @@ class Interface:
def __init__(self, fn, inputs, outputs, saliency=None, verbose=False, examples=None,
live=False, show_input=True, show_output=True,
load_fn=None, capture_session=False, title=None, description=None,
capture_session=False, title=None, description=None,
thumbnail=None, server_name=networking.LOCALHOST_NAME):
"""
:param fn: a function that will process the input panel data from the interface and return the output panel data.
@ -104,8 +104,13 @@ class Interface:
for iface, param in zip(config["input_interfaces"], param_names):
if not iface[1]["label"]:
iface[1]["label"] = param.replace("_", " ")
for i, iface in enumerate(config["output_interfaces"]):
ret_name = "Output " + str(i) if len(config["output_interfaces"]) > 1 else "Output"
if not iface[1]["label"]:
iface[1]["label"] = ret_name
except ValueError:
pass
return config

View File

@ -11,15 +11,15 @@ const radio = {
}
html += "</div>"
this.target.html(html);
this.target.find("input:first-child").prop("checked", true);
},
submit: function() {
checked_val = this.target.find("input:checked").val();
if (checked_val) {
this.io_master.input(this.id, this.choices[checked_val]);
}
this.io_master.input(this.id, this.choices[checked_val]);
},
clear: function() {
this.target.find("input").prop("checked", false);
this.target.find("input:first-child").prop("checked", true);
},
load_example: function(data) {
let child = this.choices.indexOf(data) + 1;

BIN
dist/gradio-0.9.6-py3.7.egg vendored Normal file

Binary file not shown.

View File

@ -308,7 +308,7 @@ class Image(AbstractInput):
return array
def process_example(self, example):
if os.path.exists(example)
if os.path.exists(example):
return preprocessing_utils.convert_file_to_base64(example)
else:
return example

View File

@ -104,8 +104,13 @@ class Interface:
for iface, param in zip(config["input_interfaces"], param_names):
if not iface[1]["label"]:
iface[1]["label"] = param.replace("_", " ")
for i, iface in enumerate(config["output_interfaces"]):
ret_name = "Output " + str(i) if len(config["output_interfaces"]) > 1 else "Output"
if not iface[1]["label"]:
iface[1]["label"] = ret_name
except ValueError:
pass
return config