Spaces:
Sleeping
Sleeping
File size: 5,062 Bytes
7fdb8e9 |
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
<!DOCTYPE html>
<html>
<head>
<title>PDF Upload</title>
<style>
:root {
--primary-color: #a0a0a0;
--background-color: #1a1a1a;
--card-background: #2d2d2d;
--text-color: #e0e0e0;
--border-radius: 12px;
--shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
max-width: 900px;
margin: 0 auto;
padding: 20px;
background-color: var(--background-color);
color: var(--text-color);
}
.card {
background: var(--card-background);
border-radius: var(--border-radius);
box-shadow: var(--shadow);
padding: 2rem;
margin: 2rem 0;
}
.upload-form {
border: 2px dashed #404040;
padding: 2rem;
text-align: center;
margin: 1.5rem 0;
border-radius: var(--border-radius);
background: #363636;
transition: all 0.3s ease;
}
.upload-form:hover {
border-color: var(--primary-color);
background: #404040;
}
.nav {
background: var(--card-background);
padding: 1rem;
border-radius: var(--border-radius);
box-shadow: var(--shadow);
margin-bottom: 2rem;
}
.nav a {
margin-right: 20px;
text-decoration: none;
color: var(--primary-color);
font-weight: 500;
padding: 0.5rem 1rem;
border-radius: 6px;
transition: all 0.3s ease;
}
.nav a:hover {
background: #363636;
}
h1 {
color: var(--primary-color);
text-align: center;
margin-bottom: 1.5rem;
}
input[type="file"] {
display: none;
}
.file-upload-label {
display: inline-block;
padding: 12px 24px;
background: var(--primary-color);
color: white;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
}
.file-upload-label:hover {
background: #909090;
}
.selected-file {
margin-top: 1rem;
color: #b0b0b0;
}
button {
background: var(--primary-color);
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s ease;
margin-top: 1rem;
}
button:hover {
background: #909090;
transform: translateY(-2px);
}
.status-message {
margin-top: 1rem;
padding: 1rem;
border-radius: 6px;
text-align: center;
}
.success {
background: #2e4a3d;
color: #7ee2b8;
}
.error {
background: #4a2e2e;
color: #e27e7e;
}
.loading-placeholder {
display: none;
margin-top: 1rem;
color: #b0b0b0;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% {
opacity: 0.6;
}
50% {
opacity: 1;
}
100% {
opacity: 0.6;
}
}
</style>
</head>
<body>
<div class="nav">
<a href="/">Upload</a>
<a href="/chat">Chat</a>
</div>
<div class="card">
<h1>Upload Documents</h1>
<div class="upload-form">
<form action="/upload" method="post" enctype="multipart/form-data" id="uploadForm">
<label for="file-upload" class="file-upload-label">
Choose PDF Files
</label>
<input id="file-upload" type="file" name="file" accept=".pdf" multiple onchange="updateFileName(this)">
<div id="selectedFile" class="selected-file"></div>
<div id="loadingPlaceholder" class="loading-placeholder">Processing file...</div>
<button type="submit" onclick="showLoading()">Upload</button>
</form>
</div>
</div>
<script>
function updateFileName(input) {
const fileNames = Array.from(input.files)
.map(file => file.name)
.join(', ');
document.getElementById('selectedFile').textContent = fileNames || 'No file selected';
}
function showLoading() {
if (document.getElementById('file-upload').files.length > 0) {
document.getElementById('selectedFile').style.display = 'none';
document.getElementById('loadingPlaceholder').style.display = 'block';
}
}
</script>
</body>
</html> |