mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-22 08:12:27 +00:00
Fixed Playground
This commit is contained in:
parent
b8339e397b
commit
a50f026701
@ -107,7 +107,7 @@ class Senpy(object):
|
|||||||
candidates = self.filter_plugins(is_activated=True)
|
candidates = self.filter_plugins(is_activated=True)
|
||||||
if len(candidates) > 0:
|
if len(candidates) > 0:
|
||||||
candidate = list(candidates.values())[0]
|
candidate = list(candidates.values())[0]
|
||||||
logger.debug("Default: {}".format(candidate))
|
logger.debug("Default: {}".format(candidate.name))
|
||||||
return candidate
|
return candidate
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
var ONYX = "http://www.gsi.dit.upm.es/ontologies/onyx/ns#";
|
var ONYX = "http://www.gsi.dit.upm.es/ontologies/onyx/ns#";
|
||||||
var RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
var RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
||||||
var plugins_params={};
|
var plugins_params={};
|
||||||
|
|
||||||
function replaceURLWithHTMLLinks(text) {
|
function replaceURLWithHTMLLinks(text) {
|
||||||
console.log('Text: ' + text);
|
console.log('Text: ' + text);
|
||||||
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||||
@ -15,6 +16,15 @@ function encodeHTML(text) {
|
|||||||
.replace(/'/g, ''');
|
.replace(/'/g, ''');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function hashchanged(){
|
||||||
|
var hash = location.hash
|
||||||
|
, hashPieces = hash.split('?');
|
||||||
|
if( hashPieces[0].length > 0 ){
|
||||||
|
activeTab = $('[href=' + hashPieces[0] + ']');
|
||||||
|
activeTab && activeTab.tab('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var response = JSON.parse($.ajax({type: "GET", url: "/api/plugins/" , async: false}).responseText);
|
var response = JSON.parse($.ajax({type: "GET", url: "/api/plugins/" , async: false}).responseText);
|
||||||
var defaultPlugin= JSON.parse($.ajax({type: "GET", url: "/api/plugins/default" , async: false}).responseText);
|
var defaultPlugin= JSON.parse($.ajax({type: "GET", url: "/api/plugins/default" , async: false}).responseText);
|
||||||
@ -55,15 +65,18 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
document.getElementById('plugins').innerHTML = html;
|
document.getElementById('plugins').innerHTML = html;
|
||||||
change_params();
|
change_params();
|
||||||
|
$(window).on('hashchange', hashchanged);
|
||||||
|
hashchanged();
|
||||||
|
$('.tooltip-form').tooltip();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function change_params(){
|
function change_params(){
|
||||||
var plugin = document.getElementById("plugins").options[document.getElementById("plugins").selectedIndex].value;
|
var plugin = document.getElementById("plugins").options[document.getElementById("plugins").selectedIndex].value;
|
||||||
|
|
||||||
|
html=""
|
||||||
for (param in plugins_params[plugin]){
|
for (param in plugins_params[plugin]){
|
||||||
if (param || plugins_params[plugin][param].length > 1){
|
if (param || plugins_params[plugin][param].length > 1){
|
||||||
html=""
|
|
||||||
html+= "<label> Parameter "+param+"</label>"
|
html+= "<label> Parameter "+param+"</label>"
|
||||||
html+= "<select id=\""+param+"\" name=\""+param+"\">"
|
html+= "<select id=\""+param+"\" name=\""+param+"\">"
|
||||||
for (option in plugins_params[plugin][param]){
|
for (option in plugins_params[plugin][param]){
|
||||||
@ -93,3 +106,5 @@ function load_JSON(){
|
|||||||
document.getElementById("input_request").innerHTML = "<label>"+url+"</label>"
|
document.getElementById("input_request").innerHTML = "<label>"+url+"</label>"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,19 +16,19 @@
|
|||||||
<script src="static/js/bootstrap.min.js"></script>
|
<script src="static/js/bootstrap.min.js"></script>
|
||||||
<script src="static/js/main.js"></script>
|
<script src="static/js/main.js"></script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<h3 id="header-title">
|
<h3 id="header-title">
|
||||||
<a href="https://github.com/gsi-upm/senpy" target="_blank">
|
<a href="https://github.com/gsi-upm/senpy" target="_blank">
|
||||||
<img id="header-logo" class="imsg-responsive" src="static/img/header.png"/></a> Playground
|
<img id="header-logo" class="imsg-responsive" src="static/img/header.png"/></a> Playground
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li role="presentation" class="active"><a class="active" href="#about" role="tab" data-toggle="tab">About</a></li>
|
<li role="presentation" class="active"><a class="active" href="#about">About</a></li>
|
||||||
<li role="presentation"><a class="active" href="#test" role="tab" data-toggle="tab">Test it</a></li>
|
<li role="presentation"><a class="active" href="#test">Test it</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
@ -36,11 +36,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 ">
|
<div class="col-lg-6 ">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<h2>Test our services</h2>
|
<h2>Test Senpy</h2>
|
||||||
<div>
|
<div>
|
||||||
<p>EUROSENTIMENT provides services and resources for Sentiment Analysis in several languages. There are several utilities, code snippets and instructions on how to make use of the platform publicly available. However, all of them require the installation of a third party tool or the use of a programming language to consume the API.</p>
|
|
||||||
<p>The EUROSENTIMENT Playground solves this problem by providing an easy-to-use web interface to make API calls.</p>
|
|
||||||
<p>Read our simple instructions and start using EUROSENTIMENT today! Once you're ready, head to the right section:</p>
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
|
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
|
||||||
</p>
|
</p>
|
||||||
@ -51,28 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 ">
|
<div class="col-lg-6 ">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><i class="fa fa-sign-in"></i> Sign up in the <a href="http://portal.eurosentiment.eu">EUROSENTIMENT portal</a></div>
|
<div class="panel-heading"><i class="fa fa-sign-in"></i> Follow us on <a href="http://www.github.com/gsi-upm/senpy">GitHub</a></div>
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading"><i class="fa fa-pencil-square-o"></i> Get your access token.</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<p>Your credentials will allow you to access any service available to you.</p>
|
|
||||||
<p>For convenience, some services might be publicly available, under heavy restrictions.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading"> <i class="fa fa-sliders"></i> Add the parameters you need for the service.</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<ol>
|
|
||||||
<li>Set the endpoint</li>
|
|
||||||
<li>Choose the HTTP action (GET/POST)</li>
|
|
||||||
<li>Set the headers (for authentication)</li>
|
|
||||||
<li>Set the necessary parameters (e.g. input text, language, format...)</li>
|
|
||||||
<li>Submit your request!</li>
|
|
||||||
<li>The results will be shown in the lower part of the screen, propertly formatted.</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><i class="fa fa-child"></i> Enjoy.</div>
|
<div class="panel-heading"><i class="fa fa-child"></i> Enjoy.</div>
|
||||||
@ -95,11 +71,9 @@ I cannot believe it!</textarea></div>
|
|||||||
<div id ="params">
|
<div id ="params">
|
||||||
</div>
|
</div>
|
||||||
</br>
|
</br>
|
||||||
<button id="preview" type="button" onclick="load_JSON()" name="type">Preview!</button>
|
<a id="preview" class="btn btn-lg btn-primary" href="#" onclick="load_JSON()">Analyse!</a>
|
||||||
<!--<button id="visualise" name="type" type="button">Visualise!</button>-->
|
<!--<button id="visualise" name="type" type="button">Visualise!</button>-->
|
||||||
<button type="submit" >Download!</button>
|
|
||||||
</form>
|
</form>
|
||||||
</header>
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<span id="input_request"></span>
|
<span id="input_request"></span>
|
||||||
<pre id="results"></pre>
|
<pre id="results"></pre>
|
||||||
@ -110,6 +84,7 @@ I cannot believe it!</textarea></div>
|
|||||||
<a href="http://www.gsi.dit.upm.es" target="_blank"><img class="center-block" src="static/img/gsi.png"/> </a>
|
<a href="http://www.gsi.dit.upm.es" target="_blank"><img class="center-block" src="static/img/gsi.png"/> </a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="site-info">
|
<div id="site-info">
|
||||||
@ -122,7 +97,6 @@ I cannot believe it!</textarea></div>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
|
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user