Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +30 -2
templates/index.html
CHANGED
@@ -24,6 +24,7 @@
|
|
24 |
width: 100%;
|
25 |
max-width: 480px;
|
26 |
text-align: center;
|
|
|
27 |
}
|
28 |
h1 {
|
29 |
font-size: 1.8rem;
|
@@ -69,16 +70,34 @@
|
|
69 |
border-radius: 1rem;
|
70 |
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
|
71 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
</style>
|
73 |
</head>
|
74 |
<body>
|
75 |
<div class="card">
|
76 |
<h1>✨ AI Vision</h1>
|
77 |
-
<form action="/" enctype="multipart/form-data" method="post">
|
78 |
<input type="file" name="file" accept="image/*" required />
|
79 |
<button class="btn" type="submit">Generate Caption</button>
|
80 |
</form>
|
81 |
|
|
|
|
|
82 |
{% if caption %}
|
83 |
<img src="data:image/png;base64,{{ image_data }}" class="preview-img" />
|
84 |
<div class="result">
|
@@ -87,5 +106,14 @@
|
|
87 |
</div>
|
88 |
{% endif %}
|
89 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</body>
|
91 |
-
</html>
|
|
|
24 |
width: 100%;
|
25 |
max-width: 480px;
|
26 |
text-align: center;
|
27 |
+
position: relative;
|
28 |
}
|
29 |
h1 {
|
30 |
font-size: 1.8rem;
|
|
|
70 |
border-radius: 1rem;
|
71 |
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
|
72 |
}
|
73 |
+
.spinner {
|
74 |
+
margin-top: 1rem;
|
75 |
+
display: none;
|
76 |
+
border: 6px solid #f3f3f3;
|
77 |
+
border-top: 6px solid #4f46e5;
|
78 |
+
border-radius: 50%;
|
79 |
+
width: 36px;
|
80 |
+
height: 36px;
|
81 |
+
animation: spin 1s linear infinite;
|
82 |
+
margin-left: auto;
|
83 |
+
margin-right: auto;
|
84 |
+
}
|
85 |
+
@keyframes spin {
|
86 |
+
0% { transform: rotate(0deg); }
|
87 |
+
100% { transform: rotate(360deg); }
|
88 |
+
}
|
89 |
</style>
|
90 |
</head>
|
91 |
<body>
|
92 |
<div class="card">
|
93 |
<h1>✨ AI Vision</h1>
|
94 |
+
<form id="uploadForm" action="/" enctype="multipart/form-data" method="post">
|
95 |
<input type="file" name="file" accept="image/*" required />
|
96 |
<button class="btn" type="submit">Generate Caption</button>
|
97 |
</form>
|
98 |
|
99 |
+
<div id="spinner" class="spinner"></div>
|
100 |
+
|
101 |
{% if caption %}
|
102 |
<img src="data:image/png;base64,{{ image_data }}" class="preview-img" />
|
103 |
<div class="result">
|
|
|
106 |
</div>
|
107 |
{% endif %}
|
108 |
</div>
|
109 |
+
|
110 |
+
<script>
|
111 |
+
const form = document.getElementById('uploadForm');
|
112 |
+
const spinner = document.getElementById('spinner');
|
113 |
+
|
114 |
+
form.addEventListener('submit', () => {
|
115 |
+
spinner.style.display = 'block';
|
116 |
+
});
|
117 |
+
</script>
|
118 |
</body>
|
119 |
+
</html>
|