mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-01 11:45:36 +08:00
add text io
This commit is contained in:
parent
1f7c2e69ac
commit
36ecaff2b5
@ -181,3 +181,7 @@
|
||||
canvas {
|
||||
border: solid 1px black;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ $('body').on('click', '.clear', function(e) {
|
||||
})
|
||||
$('body').on('click', '.submit', function(e) {
|
||||
var dataURL = canvas.toDataURL("image/png");
|
||||
console.log(dataURL)
|
||||
ws.send(dataURL, function(e){
|
||||
notifyError(e)
|
||||
});
|
||||
|
@ -1,13 +1,9 @@
|
||||
var text = $("#textbox-input").val();
|
||||
|
||||
$('#clear-button').click(function(e){
|
||||
$("textbox-input").text("");
|
||||
$('body').on('click', '.clear', function(e) {
|
||||
$(".input_text").val("");
|
||||
})
|
||||
|
||||
$('#submit-button').click(function(e){
|
||||
var text = $("#textbox-input").val();
|
||||
ws.send(text, function(e){
|
||||
notifyError(e)
|
||||
});
|
||||
|
||||
$('body').on('click', '.submit', function(e) {
|
||||
text = $(".input_text").text();
|
||||
ws.send(text, function(e){
|
||||
notifyError(e)
|
||||
});
|
||||
})
|
||||
|
@ -1,3 +1,6 @@
|
||||
$('body').on('click', '.clear', function(e) {
|
||||
$(".output_text").val("");
|
||||
})
|
||||
ws.onmessage = function (event) {
|
||||
$("#textbox-output").val(event.data);
|
||||
$(".output_text").val(event.data);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
</div>
|
||||
<input class="hidden_upload" type="file" accept="image/x-png,image/gif,image/jpeg" />
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://fengyuanchen.github.io/cropper/css/cropper.css">
|
||||
<script src="https://fengyuanchen.github.io/cropper/js/cropper.js"></script>
|
||||
<script src="../static/js/interfaces/input/image_upload.js"></script>
|
||||
|
@ -9,5 +9,6 @@
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="http://yiom.github.io/sketchpad/javascripts/sketchpad.js"></script>
|
||||
<script src="../static/js/interfaces/input/sketchpad.js"></script>
|
||||
|
6
gradio/templates/input/textbox.html
Normal file
6
gradio/templates/input/textbox.html
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="gradio input text">
|
||||
<div class="role">Input</div>
|
||||
<textarea class="input_text" placeholder="Enter text here..."></textarea>
|
||||
</div>
|
||||
|
||||
<script src="../static/js/interfaces/input/textbox.js"></script>
|
6
gradio/templates/output/textbox.html
Normal file
6
gradio/templates/output/textbox.html
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="gradio output text">
|
||||
<div class="role">Output</div>
|
||||
<textarea readonly class="output_text"></textarea>
|
||||
</div>
|
||||
|
||||
<script src="../static/js/interfaces/output/textbox.js"></script>
|
Loading…
Reference in New Issue
Block a user