Skip to content

Update UI to map correctly within appliction structure #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse
import sys
from flask import Flask
from flask import Flask, render_template
from flask.ext.restful import reqparse, Api, Resource
from decoder import Decoder
from languages import new_lang_from_long_english_name
Expand All @@ -11,6 +11,10 @@
app = Flask(__name__)
api = Api(app)

@app.route('/')
def home():
return render_template('index.html')

http_parser = reqparse.RequestParser()
http_parser.add_argument('inputText', type=unicode, location='json')
http_parser.add_argument('inputLanguage', type=str, location='json')
Expand Down
6 changes: 0 additions & 6 deletions html/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
110 changes: 110 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{% extends "layout.html" %}
{% block content %}


<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="page-header">
<div class="container">
<h1>Translation Demonstration</h1>
</div>
</div>

<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Input</h3>
</div>
<div class="panel-body">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter text to paraphrase"
id="sourceTxt" autofocus="autofocus" size=100 />
</div>

<!--
<select id="ppdb_size">
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL" selected="selected">XL</option>
<option value="XXL">XXL</option>
<option value="XXXL">XXXL</option>
</select>
<select id="ppdb_type">
<option value="all" selected="selected">All</option>
<option value="lex">Lexical</option>
<option value="phrasal">Phrasal</option>
<option value="syntactic">Syntactic</option>
</select>
-->

</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><a data-toggle="collapse" href="#params">Parameters</a></h3>
</div>
<div id="params" class="panel-collapse collapse">
<div class="panel-body">
<div class="col-md-4">
<div class="input-group">
<span class="input-group-addon" id="label-host">Host</span>
<input type="text" class="form-control" value="127.0.0.1" size="15" id="server_host"
aria-describedby="label-host" />
<span class="input-group-addon" id="label-port">Port</span>
<input type="text" class="form-control" value="5674" size="5" id="server_port"
aria-describedby="label-port" />
</div>
<br/>

<h5>Feature weights</h5>
<div id="feature_weights">
<div class="input-group">
<span class="input-group-addon" id="label-lm">LM weight</span>
<input type="text" class="form-control" value="1.0" size="8" id="lm_weight"
aria-describedby="label-lm" />
</div>
<button type="button" class="btn btn-primary-outline" id="add_weight">+</button>
</div>
</div>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Custom rules</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-4">
<form class="form-inline">
<div class="form-group">
<input type="text" class="form-control" placeholder="Source phrase"
id="sourcePhrase" size=20 />
<input type="text" class="form-control" placeholder="Target phrase"
id="targetPhrase" size=20 />
</div>
<button type="button" class="btn btn-primary" id="add_weight">Add</button>
</form>
</div>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Output</h3>
</div>
<div class="panel-body" id="output">
</div>
</div>

<hr/>

<footer>
<p>&copy; 2016 Johns Hopkins University</p>
</footer>
</div> <!-- /container -->

{% endblock %}
36 changes: 8 additions & 28 deletions html/index.html → templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<title>Joshua Machine Translation Toolkit</title>

<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="../static/js/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<style type="text/css">
/* Move down content because we have a fixed navbar that is 50px tall */
Expand All @@ -26,30 +26,10 @@
<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
Joshua Machine Translation Toolkit
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<!-- <form class="navbar-form navbar-right"> -->
<!-- <div class="form-group"> -->
<!-- <input type="text" placeholder="Email" class="form-control"> -->
<!-- </div> -->
<!-- <div class="form-group"> -->
<!-- <input type="password" placeholder="Password" class="form-control"> -->
<!-- </div> -->
<!-- <button type="submit" class="btn btn-success">Sign in</button> -->
<!-- </form> -->
</div><!--/.navbar-collapse -->
</div>
<div class="container">
{% block content %}
{% endblock %}
</div>
</nav>

<!-- Main jumbotron for a primary marketing message or call to action -->
Expand Down Expand Up @@ -160,9 +140,9 @@ <h3 class="panel-title">Output</h3>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="demo.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="../static/js/jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="../static/js/demo.js"></script>
<script src="../static/js/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>