【新增】测试home主页

This commit is contained in:
luhuibo 2019-10-16 23:21:39 +08:00
parent 36bff5c4bb
commit 7e4d65eeb5
3 changed files with 102 additions and 1 deletions

2
run.py
View File

@ -37,7 +37,7 @@ app.root_path = abspath(dirname(__file__))
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
def index(): def index():
app.logger.info("flask run~~") app.logger.info("flask run~~")
return render_template('main.html') return render_template('home.html')
if __name__ == "__main__": if __name__ == "__main__":

BIN
static/images/pika.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

101
templates/home.html Normal file
View File

@ -0,0 +1,101 @@
<!DOCTYPE html>
<head>
<title>文本自动摘要valuebai</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel=icon href=../static/images/pika.ico>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div>
<a onclick="Example1()" href="#">
<h6>范例1 <span class="glyphicon glyphicon-star"></span></h6></a>
<a onclick="Example2()" href="#">
<h6>范例2 <span class="glyphicon glyphicon-star"></span></h6></a>
<a onclick="Example3()" href="#">
<h6>范例3 <span class="glyphicon glyphicon-star"></span></h6></a>
</div>
<form action="" name="form1" method="POST">
<h2>请输入内容:</h2>
<p><textarea class="form-control" id="inputText" rows="7"></textarea></p>
<input type="submit" onclick="fun_keyword()" name="keyword" value="Go提取关键词"/>
<input type="submit" onclick="fun_summarization()" name="summarization" value="Go提取文本摘要"/>
</form>
<form action="http://localhost:8188/result" method="POST">
<h2>结果显示:</h2>
<p><textarea class="form-control" id="showresult" rows="7" name="nm"></textarea></p>
</form>
{% block content %}
<div class="container">
{% block page_content %}{% endblock %}
</div>
{% endblock %}
</div>
<div id="footer" style="background-color:rgba(64,181,255,0.33);clear:both;text-align:center;">
<a href="https://github.com/Valuebai/">2019 &copy; github.com/valuebai</a>
</div>
<!--script type=text/javascript src="{{url_for('static', filename='jquery.js') }}"></script-->
<script type=text/javascript src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script>
function Example1() {
document.getElementById("inputText").value = "中新网6月23日电 (记者潘旭临) 意大利航空首席商务官乔治先生22日在北京接受中新网记者专访时表示意航确信中国市场对意航的重要性目前意航已将发展中国市场提升到战略层级的高度未来意航将加大在华布局提升业务水平。\
到意大利航空履职仅7个月的乔治主要负责包括中国市场在内的亚太业务。乔治称随着对华业务不断提升意航明年可能会将每周4班提高到每天一班。同时意航会借罗马新航站楼启用之际吸引更多中国旅客到意大利旅游和转机。\
此外,还将加大对北京直飞航线的投资,如翻新航班座椅,增加电视中有关中国内容的娱乐节目、提高机上中文服务、餐饮服务、完善意航中文官方网站,提升商务舱和普通舱的舒适度等。"
document.getElementById("inputText").text = "中新网6月23日电 (记者潘旭临) 意大利航空首席商务官乔治先生22日在北京接受中新网记者专访时表示意航确信中国市场对意航的重要性目前意航已将发展中国市场提升到战略层级的高度未来意航将加大在华布局提升业务水平。\
到意大利航空履职仅7个月的乔治主要负责包括中国市场在内的亚太业务。乔治称随着对华业务不断提升意航明年可能会将每周4班提高到每天一班。同时意航会借罗马新航站楼启用之际吸引更多中国旅客到意大利旅游和转机。\
此外,还将加大对北京直飞航线的投资,如翻新航班座椅,增加电视中有关中国内容的娱乐节目、提高机上中文服务、餐饮服务、完善意航中文官方网站,提升商务舱和普通舱的舒适度等。"
}
function Example2() {
document.getElementById("inputText").value = "王靖清说他是一个很好看的人,林诗宁表示她也是这么想的。"
document.getElementById("inputText").text = "王靖清说他是一个很好看的人,林诗宁表示她也是这么想的。"
}
function Example3() {
document.getElementById("inputText").value = "中新网6月23日电 (记者潘旭临) 意大利航空首席商务官乔治先生22日在北京接受中新网记者专访时表示意航确信中国市场对意航的重要性目前意航已将发展中国市场提升到战略层级的高度未来意航将加大在华布局提升业务水平。\
到意大利航空履职仅7个月的乔治主要负责包括中国市场在内的亚太业务。乔治称随着对华业务不断提升意航明年可能会将每周4班提高到每天一班。同时意航会借罗马新航站楼启用之际吸引更多中国旅客到意大利旅游和转机。\
此外,还将加大对北京直飞航线的投资,如翻新航班座椅,增加电视中有关中国内容的娱乐节目、提高机上中文服务、餐饮服务、完善意航中文官方网站,提升商务舱和普通舱的舒适度等。"
}
function fun_keyword() {
text = document.getElementById("inputText").text;
if (text == undefined)
window.alert("请输入内容,或点击范例!");
document.form1.action = "/extract/keyword";
text.submit();
}
function fun_summarization() {
text = document.getElementById("inputText").text;
if (text == undefined)
window.alert("请输入内容,或点击范例!");
document.form1.action = "/extract/summarization";
text.submit();
}
</script>
</body>
</html>