mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
import gradiohub
This commit is contained in:
parent
c75e381825
commit
ec8e89e934
@ -1,30 +0,0 @@
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
nav {
|
||||
text-align: center;
|
||||
padding: 16px 0 4px;
|
||||
}
|
||||
nav img {
|
||||
margin-right: auto;
|
||||
height: 32px;
|
||||
}
|
||||
#bulk_rows td {
|
||||
text-align: center;
|
||||
height: 60px;
|
||||
}
|
||||
#bulk_rows tr:nth-child(even) {
|
||||
background: #DDD
|
||||
}
|
||||
#bulk_rows img {
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
}
|
||||
#bulk_rows {
|
||||
margin: 0 auto;
|
||||
width: 70%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
4
gradio/static/css/font-awesome.min.css
vendored
4
gradio/static/css/font-awesome.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,14 +1,12 @@
|
||||
.panel {
|
||||
min-width: 300px;
|
||||
flex-grow: 1;
|
||||
flex: 1 1 0;
|
||||
display: inline-block;
|
||||
max-width: 45%;
|
||||
min-width: 300px;
|
||||
box-sizing: border-box;
|
||||
margin: 0 14px 14px;
|
||||
margin: 0 30px 14px 0;
|
||||
}
|
||||
.panel_header, .interface {
|
||||
background-color: #F6F6F6;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
.panel_header {
|
||||
text-transform: uppercase;
|
||||
@ -37,7 +35,7 @@
|
||||
display: flex;
|
||||
}
|
||||
.submit, .clear, .panel_button {
|
||||
background-color: #F6F6F6 !important;
|
||||
background-color: #EEEEEE !important;
|
||||
flex-grow: 1;
|
||||
padding: 8px !important;
|
||||
box-sizing: border-box;
|
||||
@ -55,7 +53,7 @@
|
||||
}
|
||||
.flag_message {
|
||||
padding: 8px !important;
|
||||
background-color: #F6F6F6 !important;
|
||||
background-color: #EEEEEE !important;
|
||||
}
|
||||
.clear, .flag {
|
||||
margin-left: 8px;
|
||||
@ -107,20 +105,11 @@
|
||||
.flag.flagged {
|
||||
background-color: pink !important;
|
||||
}
|
||||
|
||||
.test_panel {
|
||||
margin-top: 5px;
|
||||
padding:10px;
|
||||
background-color: #eea45d6b !important;
|
||||
border: 1px solid #EEA45D;
|
||||
justify-content: space-between;
|
||||
#loading {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tests {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.test_panel > input[type="button"] {
|
||||
max-width: 100px;
|
||||
.invisible {
|
||||
display: none !important;
|
||||
}
|
||||
|
@ -63,3 +63,29 @@ button.secondary {
|
||||
color: black;
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
#featured_table {
|
||||
border-collapse: collapse;
|
||||
border: solid 2px #EEEEEE;
|
||||
margin-bottom: 20px;
|
||||
table-layout: fixed;
|
||||
}
|
||||
#featured_table td {
|
||||
padding: 4px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
width: 250px;
|
||||
max-width: 250px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
#featured_table tr:nth-child(even) {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
#featured_table tr:hover {
|
||||
background-color: #EEA45D;
|
||||
}
|
||||
#featured_history img {
|
||||
height: 60px;
|
||||
width: 100px;
|
||||
}
|
||||
|
BIN
gradio/static/img/logo_error.png
Normal file
BIN
gradio/static/img/logo_error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 58 KiB |
@ -5,6 +5,10 @@ var io_master = {
|
||||
var post_data = {
|
||||
'data': data
|
||||
};
|
||||
$("#loading").removeClass("invisible");
|
||||
$("#loading_in_progress").show();
|
||||
$("#loading_failed").hide();
|
||||
$("#output_interface").addClass("invisible");
|
||||
$.ajax({type: "POST",
|
||||
url: "/api/predict/",
|
||||
data: JSON.stringify(post_data),
|
||||
@ -14,6 +18,8 @@ var io_master = {
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$("#loading_in_progress").hide();
|
||||
$("#loading_failed").show();
|
||||
console.log(XMLHttpRequest);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
@ -26,28 +32,14 @@ var io_master = {
|
||||
if (this.input_interface.output && data["saliency"]) {
|
||||
this.input_interface.output(data["saliency"]);
|
||||
}
|
||||
},
|
||||
test: function(type, data) {
|
||||
var post_data = {
|
||||
'data': data
|
||||
};
|
||||
if (type == "rotation") {
|
||||
$.ajax({type: "POST",
|
||||
url: "/api/auto/rotation",
|
||||
data: JSON.stringify(post_data)
|
||||
});
|
||||
} else if (type == "lighting") {
|
||||
$.ajax({type: "POST",
|
||||
url: "/api/auto/lighting",
|
||||
data: JSON.stringify(post_data)
|
||||
});
|
||||
}
|
||||
$("#loading").addClass("invisible");
|
||||
$("#output_interface").removeClass("invisible");
|
||||
},
|
||||
flag: function(message) {
|
||||
var post_data = {
|
||||
'data': {
|
||||
'input' : this.last_input,
|
||||
'output' : this.last_output,
|
||||
'input_data' : toStringIfObject(this.last_input) ,
|
||||
'output_data' : toStringIfObject(this.last_output),
|
||||
'message' : message
|
||||
}
|
||||
}
|
||||
|
@ -49,5 +49,17 @@ const sketchpad_input = {
|
||||
this.context.clearRect(0, 0, this.context.canvas.width, this.context.
|
||||
canvas.height);
|
||||
this.target.find(".saliency_holder").addClass("hide");
|
||||
},
|
||||
renderFeatured: function(data) {
|
||||
return `<img src=${data}>`;
|
||||
},
|
||||
loadFeatured: function(data) {
|
||||
let ctx = $(".canvas_holder canvas")[0].getContext("2d");
|
||||
var img = new Image;
|
||||
let dimension = this.target.find(".canvas_holder canvas").width();
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img,0,0,dimension,dimension);
|
||||
};
|
||||
img.src = data;
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,12 @@ const textbox_input = {
|
||||
this.target.find(".input_text").val("");
|
||||
this.target.find(".input_text_saliency").hide();
|
||||
this.target.find(".input_text").show();
|
||||
},
|
||||
renderFeatured: function(data) {
|
||||
return data;
|
||||
},
|
||||
loadFeatured: function(data) {
|
||||
this.clear();
|
||||
this.target.find(".input_text").val(data);
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,9 @@ $.getJSON("static/config.json", function(data) {
|
||||
input_interface.clear();
|
||||
output_interface.clear();
|
||||
$(".flag").removeClass("flagged");
|
||||
$(".flag_message").empty()
|
||||
$(".flag_message").empty
|
||||
$("#loading").addClass("invisible");
|
||||
$("#output_interface").removeClass("invisible");
|
||||
io_master.last_input = null;
|
||||
io_master.last_output = null;
|
||||
})
|
||||
|
@ -33,6 +33,13 @@ function resizeImage(base64Str, max_width, max_height, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
function toStringIfObject(input) {
|
||||
if (input instanceof Object) {
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
function paintSaliency(data, width, height, ctx) {
|
||||
var cell_width = width / data[0].length
|
||||
var cell_height = height / data.length
|
||||
|
@ -44,15 +44,14 @@
|
||||
<input class="submit" type="submit" value="submit"/>
|
||||
<input class="clear" type="reset" value="clear">
|
||||
</div>
|
||||
<div class="tests"></div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel_header">
|
||||
Output
|
||||
<div class="loading">
|
||||
<img src="../static/img/logo_mini.png" class="ld ld-skew"/>
|
||||
<span class="loading_time"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loading" class="interface invisible">
|
||||
<img id="loading_in_progress" src="../static/img/logo_loading.gif">
|
||||
<img id="loading_failed" src="../static/img/logo_error.png">
|
||||
</div>
|
||||
<div id="output_interface" class="interface"></div>
|
||||
<div class="panel_buttons">
|
||||
|
Loading…
Reference in New Issue
Block a user