SpacyModelCreator / templates /savejson.html
WebashalarForML's picture
Upload 6 files
342c773 verified
raw
history blame
8.17 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Upload and Process JSON</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css" rel="stylesheet" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
/>
<style>
body {
background-color: #121212;
font-family: 'Poppins', sans-serif;
color: #e0e0e0;
margin: 0;
padding: 0;
}
h1 {
color: #ffffff;
text-align: center;
margin: 50px 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.file-upload-section {
background-color: #1e1e1e;
padding: 30px;
border-radius: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
text-align: center;
animation: fadeInUp 1.5s ease;
}
.file-upload-section input[type="file"] {
background-color: #2c2c2c;
border: 1px solid #444;
color: #e0e0e0;
border-radius: 5px;
width: 100%;
margin-bottom: 20px;
transition: background-color 0.3s ease;
}
.file-upload-section input[type="file"]:hover,
.file-upload-section input[type="file"]:focus {
background-color: #3a3a3a;
outline: none;
}
.btn-custom {
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
display: flex;
align-items: center;
gap: 8px;
}
.btn-upload {
background-color: #007bff;
border: 1px solid #007bff;
}
.btn-upload:hover {
background-color: transparent;
border: 1px solid #007bff;
}
.btn-process {
background-color: #28a745;
border: 1px solid #28a745;
}
.btn-process:hover {
background-color: transparent;
border: 1px solid #28a745;
}
.btn-restart {
background-color: #dc3545;
}
.btn-restart:hover {
background-color: #c82333;
}
.btn-next {
background-color: #4CAF50;
border: 1px solid #4caf50;
}
.btn-next:hover {
background-color: transparent;
border: 1px solid #4caf50;
}
.text-center {
text-align: center;
}
.restart-button {
margin-top: 20px;
margin-left: 20px;
display: flex;
}
.file-actions {
margin-top: 20px;
}
.guide {
background-color: #1e1e1e;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.guide-button {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
}
.guide-button a {
font-size: 16px;
color: #17a2b8;
padding: 5px 10px;
border-radius: 5px;
text-decoration: none;
}
.guide-button a:hover {
background-color: #138496b9;
}
.fas.fa-info-circle {
margin-right: 5px;
}
</style>
</head>
<body>
<!-- Guide Button -->
<div class="guide-button">
<a href="{{ url_for('guide') }}" class="btn">
<i class="fas fa-info-circle"></i> Guide
</a>
</div>
<!-- Restart button -->
<div class="text-center restart-button">
<form action="{{ url_for('remove_files') }}" method="post">
<input type="hidden" name="folder_type" value="uploads">
<button type="submit" class="btn btn-custom btn-restart">
<i class="bi bi-arrow-repeat"></i> Restart
</button>
</form>
</div>
<div class="container mt-5">
<h1 class="text-center">Upload and Process JSON</h1>
<!-- Progress Bar -->
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 80%;" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100">Step 4 of 5</div>
</div>
<div class="file-upload-section">
<!-- Form to upload JSON file -->
<form action="{{ url_for('upload_json_file') }}" method="POST" enctype="multipart/form-data">
<div class="form-group mb-3">
<label for="file" class="form-label">Select JSON file to upload:</label>
<input type="file" class="form-control" id="file" name="file" accept=".json" required/>
</div>
<button type="submit" class="btn btn-custom btn-upload">
<i class="bi bi-upload"></i> Upload JSON
</button>
</form>
<!-- Process JSON button -->
<div class="text-center mt-4">
<form action="{{ url_for('process_json_file') }}" method="GET">
<button type="submit" class="btn btn-custom btn-process">
<i class="bi bi-gear"></i> Process Save JSON
</button>
</form>
</div>
<!-- Next button -->
<div class="text-center mt-4">
<form action="{{ url_for('spacy_file') }}" method="GET">
<button type="submit" class="btn btn-custom btn-next">
<i class="bi bi-arrow-right"></i> Next
</button>
</form>
</div>
<!-- Uploaded JSON actions -->
{% if session.get('uploaded_json') %}
<div class="file-actions">
<p>Uploaded: <span class="text-danger">{{ session.get('uploaded_json') }}</span></p>
<form action="{{ url_for('remove_all_json_files') }}" method="post" class="d-flex justify-content-center">
<button type="submit" class="btn btn-outline-danger">
<i class="bi bi-trash"></i> Remove Uploaded JSON
</button>
</form>
</div>
{% endif %}
</div>
<!-- Success messages -->
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="alert alert-success mt-4" id="flash-message">{{ messages[0] }}</div>
{% endif %}
{% endwith %}
<!-- Guide for saving JSON -->
<div class="guide">
<h5>Instructions:</h5>
<ol class="">
<li>Upload your downloaded JSON file from the annotation step.</li>
<li>Click "Process" to save required JSON format.</li>
<li>Click "Next" to proceed with training the model using the processed JSON file.</li>
</ol>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
setTimeout(function() {
let flashMessage = document.getElementById('flash-message');
if (flashMessage) {
flashMessage.style.transition = 'opacity 1s ease';
flashMessage.style.opacity = 0;
setTimeout(() => flashMessage.remove(), 1000);
}
}, 3000);
</script>
</body>
</html>