diff --git a/demo/flip_image.py b/demo/flip_image.py index 9c548715a5..bd95907cf8 100644 --- a/demo/flip_image.py +++ b/demo/flip_image.py @@ -11,12 +11,12 @@ def flip(image): def flip2(image): start = time() - return np.fliplr(image), time() - start + return np.fliplr(image), "stuff" -gr.Interface(flip2, +gr.Interface([flip, flip2], gr.inputs.Image(shape=(50, 50, 3)), - ["image", "text"], + ["image", "label"], examples=[ ["images/cheetah1.jpg"], ["images/cheetah2.jpg"], diff --git a/gradio.egg-info/requires.txt b/gradio.egg-info/requires.txt index 81362cf660..6bb220b721 100644 --- a/gradio.egg-info/requires.txt +++ b/gradio.egg-info/requires.txt @@ -4,7 +4,4 @@ paramiko scipy IPython scikit-image -<<<<<<< HEAD -======= analytics-python ->>>>>>> 64fd79682b1939bca6d2efe2556fc7a7b43b1d9d diff --git a/gradio/static/css/gradio.css b/gradio/static/css/gradio.css index f5f39cb8a8..95d4de6511 100644 --- a/gradio/static/css/gradio.css +++ b/gradio/static/css/gradio.css @@ -31,10 +31,18 @@ display: flex; flex-flow: column; } +.output_panel { + position: relative; +} .loading { + position: absolute; + top: 10px; + left: 10px; margin-left: auto; + z-index: 1; } .loading img { + width: 50px; display: none; } .panel_buttons { diff --git a/gradio/static/css/interfaces/output/textbox.css b/gradio/static/css/interfaces/output/textbox.css index a6ed5e1ab0..2dc62e3db2 100644 --- a/gradio/static/css/interfaces/output/textbox.css +++ b/gradio/static/css/interfaces/output/textbox.css @@ -9,4 +9,7 @@ padding: 4px; min-height: 30px; font-family: monospace; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + word-wrap: break-word; /* IE */ } diff --git a/gradio/static/img/logo_error.png b/gradio/static/img/logo_error.png index 6629a6d514..7b22195776 100644 Binary files a/gradio/static/img/logo_error.png and b/gradio/static/img/logo_error.png differ diff --git a/gradio/static/js/all_io.js b/gradio/static/js/all_io.js index dcee3bf99e..7a7ca9eae7 100644 --- a/gradio/static/js/all_io.js +++ b/gradio/static/js/all_io.js @@ -22,8 +22,7 @@ var io_master_template = { this.target.find(".loading").removeClass("invisible"); this.target.find(".loading_in_progress").show(); this.target.find(".loading_failed").hide(); - this.target.find(".output_interface").addClass("invisible"); - this.target.find(".output_interfaces .panel_header").addClass("invisible"); + this.target.find(".output_interfaces").css("opacity", 0.5); } this.fn(this.last_input).then((output) => { io.output(output); @@ -54,8 +53,7 @@ var io_master_template = { }, refresh_lag); } else { this.target.find(".loading").addClass("invisible"); - this.target.find(".output_interface").removeClass("invisible"); - this.target.find(".output_interfaces .panel_header").removeClass("invisible"); + this.target.find(".output_interfaces").css("opacity", 1); } }, flag: function(message) { diff --git a/gradio/static/js/all_io.js.bak b/gradio/static/js/all_io.js.bak deleted file mode 100644 index 183450f4a5..0000000000 --- a/gradio/static/js/all_io.js.bak +++ /dev/null @@ -1,73 +0,0 @@ -var io_master_template = { - gather: function() { - this.clear(); - for (let iface of this.input_interfaces) { - iface.submit(); - } - }, - clear: function() { - this.last_input = new Array(this.input_interfaces.length); - this.input_count = 0; - }, - input: function(interface_id, data) { - this.last_input[interface_id] = data; - this.input_count += 1; - if (this.input_count == this.input_interfaces.length) { - this.submit(); - } - }, - submit: function() { - let io = this; - if (!this.config.live) { - this.target.find(".loading").removeClass("invisible"); - this.target.find(".loading_in_progress").show(); - this.target.find(".loading_failed").hide(); - this.target.find(".output_interface").addClass("invisible"); - this.target.find(".output_interfaces .panel_header").addClass("invisible"); - } - this.fn(this.last_input).then((output) => { - io.output(output); - }).catch((error) => { - console.error(error); - this.target.find(".loading_in_progress").hide(); - this.target.find(".loading_failed").show(); - }) - }, - output: function(data) { - this.last_output = data["data"]; - - for (let i = 0; i < this.output_interfaces.length; i++) { - this.output_interfaces[i].output(data["data"][i]); - } - if (data["durations"]) { - let ratio = this.output_interfaces.length / data["durations"].length; - for (let i = 0; i < this.output_interfaces.length; i = i + ratio) { - this.output_interfaces[i].target.parent().find(`.loading_time[interface="${i + ratio - 1}"]`).text("Latency: " + ((data["durations"][i / ratio])).toFixed(2) + "s"); - } - } - - if (this.config.live) { - this.gather(); - } else { - this.target.find(".loading").addClass("invisible"); - this.target.find(".output_interface").removeClass("invisible"); - this.target.find(".output_interfaces .panel_header").removeClass("invisible"); - } - }, - flag: function(message) { - var post_data = { - 'data': { - 'input_data' : toStringIfObject(this.last_input) , - 'output_data' : toStringIfObject(this.last_output), - 'message' : message - } - } - $.ajax({type: "POST", - url: "/api/flag/", - data: JSON.stringify(post_data), - success: function(output){ - console.log("Flagging successful") - }, - }); - } -}; diff --git a/gradio/static/js/gradio.js b/gradio/static/js/gradio.js index ab5343535d..f6660c09b2 100644 --- a/gradio/static/js/gradio.js +++ b/gradio/static/js/gradio.js @@ -11,7 +11,7 @@ function gradio(config, fn, target) {