initial commit
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>诗歌生成器-首页</title>
|
||||
<link rel="stylesheet" href="/static/css/common.css">
|
||||
<link rel="stylesheet" href="/static/css/index.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- 导航栏 -->
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
||||
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<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="#">Brand</a> -->
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li> -->
|
||||
<li><a href="/square">广场</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">主题 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">爱情</a></li>
|
||||
<li><a href="#">家国</a></li>
|
||||
<li><a href="#">田园</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<form class="navbar-form navbar-left" action="{{ url_for('to_square') }}" method="get">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="query" placeholder="搜索">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
|
||||
<!-- 主题部分 -->
|
||||
<div class="main">
|
||||
<!-- 标题 -->
|
||||
<div class="title">
|
||||
<h2>诗歌生成器</h2>
|
||||
<p class="lead">创造一首诗歌</p>
|
||||
<h3>请输入本诗首句</h3>
|
||||
</div>
|
||||
|
||||
<!-- 提示词,输出框 -->
|
||||
<div class="put">
|
||||
<div class="pointout">
|
||||
<span>想不到意象提示?试试生成一个</span>
|
||||
<samp id="promote"></samp>
|
||||
<div class="btn-group" role="group" aria-label="...">
|
||||
<button type="button" class="btn btn-default" id="generate-btn">随机意象</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 输入框 -->
|
||||
<div class="poem-input row">
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-lg-6">
|
||||
<form method="post" action="/predict">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="请输入" name="words">
|
||||
<span class="input-group-btn">
|
||||
<input class="btn btn" type="submit" name="action" value="生成诗词">
|
||||
<input class="btn btn-warning" type="submit" name="action" value="生成藏头诗">
|
||||
</span>
|
||||
</div><!-- /input-group -->
|
||||
</form>
|
||||
</div><!-- /.col-lg-6 -->
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/static/js/jquery.js"></script>
|
||||
<script src="/static/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$('.dropdown-toggle').dropdown()
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#generate-btn').click(function () {
|
||||
$.ajax({
|
||||
url: '/promote',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#promote').text("提示词:" + data['promote']);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert('出现错误:' + error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>生成诗歌</title>
|
||||
<link rel="stylesheet" href="/static/css/common.css">
|
||||
<link rel="stylesheet" href="/static/css/poem.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- 导航栏 -->
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
||||
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<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="#">Brand</a> -->
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li> -->
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/square">广场</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">主题 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">爱情</a></li>
|
||||
<li><a href="#">家国</a></li>
|
||||
<li><a href="#">田园</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<form class="navbar-form navbar-left" action="{{ url_for('to_square') }}" method="get">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="query" placeholder="搜索">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="title">
|
||||
<h2>诗歌生成器</h2>
|
||||
</div>
|
||||
|
||||
<div class="main-poem centre">
|
||||
<div class="poem-word">
|
||||
{% for i in rs %}
|
||||
<p> {{i}}。</p><br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="poem-pic">
|
||||
<img src="{{img_path}}" alt="." class="img-rounded">
|
||||
</div>
|
||||
</div>
|
||||
<!--填写作者名称和诗歌名称,然后存入数据库-->
|
||||
<div class="submit-form centre">
|
||||
<form action="/submit_poem" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="author">作者:</label>
|
||||
<input type="text" class="form-control" id="author" name="author" placeholder="请输入作者名称" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="title">诗歌名称:</label>
|
||||
<input type="text" class="form-control" id="title" name="title" placeholder="请输入诗歌名称" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="theme">主题:</label>
|
||||
<select class="form-control" id="theme" name="theme">
|
||||
<option value="爱情" selected>爱情</option>
|
||||
<option value="家国">家国</option>
|
||||
<option value="田园">田园</option>
|
||||
<option value="友情">友情</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" id="poem" name="poem" value="{% for i in rs %}{{i}}{% endfor %}">
|
||||
<input type="hidden" id="img_path" name="img_path" value="{{img_path}}">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$('.dropdown-toggle').dropdown()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,112 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ poem.title }}</title>
|
||||
<link rel="stylesheet" href="/static/css/common.css">
|
||||
<link rel="stylesheet" href="/static/css/poem_detail.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Georgia', serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
background-color: #fff;
|
||||
padding: 30px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 36px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
background-color: #555;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
border-radius: 3px;
|
||||
margin-top: 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.poem-wrapper {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.poem-content {
|
||||
flex: 1;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.poem-pic {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.poem-pic img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
strong {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>{{ poem.title }}</h2>
|
||||
<!-- p标签居中-->
|
||||
<p style="text-align: center">
|
||||
<strong>作者:</strong>{{ poem.author }}
|
||||
<strong>主题:</strong>{{ poem.theme }}
|
||||
<strong>日期:</strong>{{ poem.date }}
|
||||
</p>
|
||||
<!-- 分割线-->
|
||||
<hr>
|
||||
<!-- 两栏显示,左边诗歌,右边图片-->
|
||||
<div class="poem-wrapper">
|
||||
<div class="poem-content">
|
||||
{% for line in poem.content.split('。') %}
|
||||
{% if line %}
|
||||
<p>{{ line }}。</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="poem-pic">
|
||||
<img src="{{poem.img_path}}" alt="." class="img-rounded">
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{ url_for('to_square') }}">返回广场</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>诗歌生成器-广场</title>
|
||||
<link rel="stylesheet" href="/static/css/common.css">
|
||||
<link rel="stylesheet" href="/static/css/square.css">
|
||||
<style>
|
||||
body {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
background-color: #ffffff;
|
||||
border-radius: 5px;
|
||||
padding: 15px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.thumbnail img {
|
||||
max-height: 150px;
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.thumbnail p {
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
|
||||
.thumbnail:hover {
|
||||
transform: scale(1.05);
|
||||
transition: transform 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 导航栏 -->
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
||||
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/square">广场</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">主题 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">爱情</a></li>
|
||||
<li><a href="#">家国</a></li>
|
||||
<li><a href="#">田园</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<form class="navbar-form navbar-left" action="{{ url_for('to_square') }}" method="get">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="query" placeholder="搜索">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="title">
|
||||
<h2>诗歌生成器-广场</h2>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="row" style="margin-left: 50px">
|
||||
{% for poem in poems %}
|
||||
|
||||
<a href="{{ url_for('view_poem', poem_id=poem.id) }}">
|
||||
<div class="col-sm-5 col-md-3">
|
||||
<div class="thumbnail">
|
||||
<img src="{{poem.img_path}}" alt="...">
|
||||
<div class="caption" style="padding: 0">
|
||||
<p><strong>题目:</strong>{{ poem.title }} | <strong>主题:</strong>{{ poem.theme }}</p>
|
||||
<p><strong>作者:</strong>{{ poem.author }} <br> <strong>日期:</strong>{{ poem.date }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/jquery.js"></script>
|
||||
<script src="/static/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$('.dropdown-toggle').dropdown()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user