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>"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,128 +1,102 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<title>Playground</title>
|
<title>Playground</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<script src="static/js/jquery-2.1.1.min.js" ></script>
|
<script src="static/js/jquery-2.1.1.min.js" ></script>
|
||||||
<!--<script src="jquery.autosize.min.js"></script>-->
|
<!--<script src="jquery.autosize.min.js"></script>-->
|
||||||
<link rel="stylesheet" href="static/css/bootstrap.min.css">
|
<link rel="stylesheet" href="static/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="static/css/main.css">
|
<link rel="stylesheet" href="static/css/main.css">
|
||||||
<link rel="stylesheet" href="static/font-awesome-4.1.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="static/font-awesome-4.1.0/css/font-awesome.min.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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">
|
||||||
<div class="tab-pane active" id="about">
|
<div class="tab-pane active" id="about">
|
||||||
<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 class="text-center">
|
||||||
<p>The EUROSENTIMENT Playground solves this problem by providing an easy-to-use web interface to make API calls.</p>
|
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
|
||||||
<p>Read our simple instructions and start using EUROSENTIMENT today! Once you're ready, head to the right section:</p>
|
</p>
|
||||||
<p class="text-center">
|
|
||||||
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 ">
|
|
||||||
<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>
|
|
||||||
<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 class="panel panel-default">
|
|
||||||
<div class="panel-heading"><i class="fa fa-child"></i> Enjoy.</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<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-child"></i> Enjoy.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane" id="test">
|
<div class="tab-pane" id="test">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<form id="form" onsubmit="return getPlugins();" accept-charset="utf-8">
|
<form id="form" onsubmit="return getPlugins();" accept-charset="utf-8">
|
||||||
<div id="inputswrapper">
|
<div id="inputswrapper">
|
||||||
<div><textarea id="input" class="boxsizingBorder" rows="5" name="i">This text makes me sad.
|
<div><textarea id="input" class="boxsizingBorder" rows="5" name="i">This text makes me sad.
|
||||||
whilst this text makes me happy and surprised at the same time.
|
whilst this text makes me happy and surprised at the same time.
|
||||||
I cannot believe it!</textarea></div>
|
I cannot believe it!</textarea></div>
|
||||||
<label>Select the plugin:</label>
|
<label>Select the plugin:</label>
|
||||||
<select id="plugins" name="plugins" onchange="change_params()">
|
<select id="plugins" name="plugins" onchange="change_params()">
|
||||||
</select>
|
</select>
|
||||||
|
</br>
|
||||||
|
<div id ="params">
|
||||||
|
</div>
|
||||||
</br>
|
</br>
|
||||||
<div id ="params">
|
<a id="preview" class="btn btn-lg btn-primary" href="#" onclick="load_JSON()">Analyse!</a>
|
||||||
</div>
|
|
||||||
</br>
|
|
||||||
<button id="preview" type="button" onclick="load_JSON()" name="type">Preview!</button>
|
|
||||||
<!--<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>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</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 id="footer">
|
||||||
|
<div class="container">
|
||||||
|
<div id="site-info">
|
||||||
|
<p>
|
||||||
|
This development has been partially funded by the European Union through the<a href="http://mixedemotions-project.eu/"><span style="text-transform:uppercase;">MixedEmotions project</span></a>(project number H2020 655632), as part of the RIA ICT 15 Big data and Open Data Innovation and take-up programme.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div id="site-logos">
|
||||||
|
<a href="http://www.gsi.dit.upm.es" target="_blank"><img id="mixedemotions-logo"src="static/img/me.png"/></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
</div>
|
||||||
<div class="container">
|
</body>
|
||||||
<div id="site-info">
|
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
|
||||||
<p>
|
|
||||||
This development has been partially funded by the European Union through the<a href="http://mixedemotions-project.eu/"><span style="text-transform:uppercase;">MixedEmotions project</span></a>(project number H2020 655632), as part of the RIA ICT 15 Big data and Open Data Innovation and take-up programme.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div id="site-logos">
|
|
||||||
<a href="http://www.gsi.dit.upm.es" target="_blank"><img id="mixedemotions-logo"src="static/img/me.png"/></a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<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