File size: 2,846 Bytes
9947d3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>AI ps</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
    <style>
        /* 自定义样式 */
        body {
            display: flex;
            flex-direction: column;
            justify-content: start;
            align-items: center;
            min-height: 100vh;
            font-family: "Helvetica Neue", sans-serif;
        }

        h1 {
            margin-top: 20px;
            margin-bottom: 30px;
            font-size: 36px;
            font-weight: bold;
            text-align: center;
        }

        form {
            margin-bottom: 50px;
        }

        .form-input {
            display: block;
            margin: 0 auto;
            margin-bottom: 30px;
        }

        input[type="file"] {
            display: none;
        }

        .custom-file-upload {
            display: inline-block;
            padding: 10px 20px;
            cursor: pointer;
            background-color: #007bff;
            color: #fff;
            border-radius: 5px;
            font-size: 18px;
            font-weight: bold;
        }

        .form-img {
            display: flex;
            justify-content: center;
            margin-top: 50px;
            margin-bottom: 50px;
        }

        .form-img img {
            max-width: 45%;
            margin-right: 10%;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
        }

        .d-flex {
            display: flex;
            justify-content: center;
        }

    </style>
</head>
<body>
<div class="container">
    <h1>ai抠图</h1>
    {% if error %}
    <div class="alert alert-danger" role="alert">{{ error }}</div>
    {% endif %}
    <form enctype="multipart/form-data" method="post">
        <div class="d-flex">
            <div class="form-group" style="margin-right: 50px;">
                <label for="file_input" class="custom-file-upload">上传图片</label>
                <input type="file" id="file_input" name="file_input" onchange="document.getElementById('file_name').innerHTML=this.value.split('\\').pop();">
                <span id="file_name"></span>
            </div>
            <div class="ml-3">
                <input name="image" type="submit" class="btn btn-primary btn-lg" value="人像抠图">
            </div>
            <div class="ml-3">
                <input name="universal" type="submit" class="btn btn-primary btn-lg" value="通用抠图">
            </div>
        </div>
    </form>
    {% if image_path %}
    <hr>
    <div class="form-img">
        <img src="{{ image_path }}" alt="上传的图片">
        {% if result_path %}
        <img src="{{ result_path }}" alt="人像抠图">
        {% endif %}
    </div>
    {% endif %}
</div>
</body>
</html>