-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
executable file
·79 lines (76 loc) · 4.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html>
<head>
<title>Dictembeds Demo</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
textarea {
resize: none;
border-radius: 3px;
}
.inputBox {
border-radius: 3px;
}
</style>
</head>
<body class="p-7 bg-gray-100 content-center" style="width: 100%; overflow-x: hidden">
<div style="margin: 0 auto; max-width: min(100%, 500px)">
<h1 class="font-bold">Dictembeds, a demo.</h1>
<br />
<div class="flex flex-wrap">
<div class="mr-4 mb-3">
<div class="text-xs text-gray-700 mb-1.5">What is the term you wish to define?</div>
<input id="title" placeholder="Chickens" class="text-sm pl-2 pr-2 inputBox"></input>
</div>
<div>
<div class="text-xs text-gray-700 mb-1.5">What are the parameters you wish to use?</div>
<div class="flex">
<div>
<input id="num_beams" placeholder="Beams" value="5" class="text-sm pl-2 pr-2 mr-2 w-7 text-center" title="number of beams" tabindex="-1"></input>
<input id="min_length" placeholder="Length" value="0" class="text-sm pl-2 pr-2 mr-2 w-10 text-center" title="minimum length" tabindex="-1"></input>
<input id="no_repeat_ngram_size" placeholder="N-grams" value="2" class="text-sm pl-2 pr-2 mr-2 w-7 text-center" title="no repeat ngram count" tabindex="-1"></input>
</div>
</div>
</div>
</div>
<br />
<br />
<div class="text-xs text-gray-700 mb-1.5">What is the context under which you want to define it?</div>
<textarea id="context" placeholder="The chicken (Gallus gallus domesticus), a subspecies of the red junglefowl, is a type of domesticated fowl, originally from Southeastern Asia. Rooster or cock is a term for an adult male bird, and younger male may be called a cockerel. A male that has been castrated is a capon. Originally raised for cockfighting or for special ceremonies, chickens were not kept for food until the Hellenistic period (4th–2nd centuries BCE). Humans now keep chickens primarily as a source of food (consuming both their meat and eggs) and as pets." class="text-sm p-2" cols="60" rows="10" style="max-width:99%;"></textarea>
<br />
<br />
<a id="button" class="p-1 text-sm rounded-md text-white bg-gray-600 hover:bg-gray-500 transition cursor-pointer" style="padding: 5px">Define!</a>
<span id="fader" class="inline-block text-xs text-gray-600 ml-2 animate-pulse" style="display: none">Waiting for response...</span>
<hr class="mt-5 mb-5" />
<div class="text-xs text-gray-700 mb-1.5">The model's output:</div>
<textarea id="output" placeholder="The model's output goes here..." class="text-sm p-2" cols="60" rows="10" readonly style="max-width:99%;"></textarea>
<script>
$( "#button" ).on( "click", function() {
$("#fader").css("display", "inline-block");
$.ajax({
type: "POST",
url: "https://socks.jemoka.com/predict",
data: JSON.stringify({
title: $("#title").val()?$("#title").val():"",
context: $("#context").val()?$("#context").val():"",
params: {
min_length: $("#min_length").val(),
num_beams: $("#num_beams").val(),
no_repeat_ngram_size: $("#no_repeat_ngram_size").val()
}
}),
success: function(data) {
$("#fader").css("display", "none");
$("#output").val(data.response);
},
contentType: "application/json"
}).fail(function(response) {
$("#output").val(response.responseJSON.response);
});
});
</script>
</div>
</body>
</html>