Spaces:
Sleeping
Sleeping
Create templates/index.html
Browse files- templates/index.html +83 -0
templates/index.html
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>Soil Report Analysis & Recommendations Generator</title>
|
| 7 |
+
<style>
|
| 8 |
+
/* Add your styles as needed */
|
| 9 |
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
| 10 |
+
.container { max-width: 900px; margin: auto; }
|
| 11 |
+
.flash-message { background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 5px; }
|
| 12 |
+
pre { background: #f4f4f4; padding: 15px; border-radius: 5px; }
|
| 13 |
+
</style>
|
| 14 |
+
</head>
|
| 15 |
+
<body>
|
| 16 |
+
<div class="container">
|
| 17 |
+
<h1>Soil Report Analysis & Recommendations Generator</h1>
|
| 18 |
+
<div class="upload-section">
|
| 19 |
+
<h2>Upload Soil Reports</h2>
|
| 20 |
+
<form id="uploadForm">
|
| 21 |
+
<input type="file" name="files" accept=".pdf,.jpg,.jpeg,.png" multiple required>
|
| 22 |
+
<div class="mb-4">
|
| 23 |
+
<label for="language">Response Language</label>
|
| 24 |
+
<select id="language" name="language" required>
|
| 25 |
+
<option value="English">English</option>
|
| 26 |
+
<option value="Hindi">Hindi</option>
|
| 27 |
+
<option value="Bengali">Bengali</option>
|
| 28 |
+
<option value="Telugu">Telugu</option>
|
| 29 |
+
<option value="Marathi">Marathi</option>
|
| 30 |
+
<option value="Tamil">Tamil</option>
|
| 31 |
+
<option value="Gujarati">Gujarati</option>
|
| 32 |
+
<option value="Urdu">Urdu</option>
|
| 33 |
+
<option value="Kannada">Kannada</option>
|
| 34 |
+
<option value="Odia">Odia</option>
|
| 35 |
+
<option value="Malayalam">Malayalam</option>
|
| 36 |
+
</select>
|
| 37 |
+
</div>
|
| 38 |
+
<button type="submit">Generate Soil Analysis & Recommendations</button>
|
| 39 |
+
</form>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div class="loading" id="loading" style="display:none;">
|
| 43 |
+
<p>Analyzing soil reports and generating analysis...</p>
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
<div id="summaryContainer" style="display: none;">
|
| 47 |
+
<h2>Analysis Result (JSON)</h2>
|
| 48 |
+
<pre id="jsonOutput"></pre>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
<script>
|
| 53 |
+
document.getElementById('uploadForm').addEventListener('submit', function(e) {
|
| 54 |
+
e.preventDefault();
|
| 55 |
+
const formData = new FormData(this);
|
| 56 |
+
const loading = document.getElementById('loading');
|
| 57 |
+
const summaryContainer = document.getElementById('summaryContainer');
|
| 58 |
+
const jsonOutput = document.getElementById('jsonOutput');
|
| 59 |
+
|
| 60 |
+
loading.style.display = 'block';
|
| 61 |
+
summaryContainer.style.display = 'none';
|
| 62 |
+
|
| 63 |
+
fetch('/', { method: 'POST', body: formData })
|
| 64 |
+
.then(response => response.json())
|
| 65 |
+
.then(data => {
|
| 66 |
+
loading.style.display = 'none';
|
| 67 |
+
summaryContainer.style.display = 'block';
|
| 68 |
+
if (data.error) {
|
| 69 |
+
jsonOutput.textContent = data.error;
|
| 70 |
+
} else {
|
| 71 |
+
// Display the JSON data in a formatted way
|
| 72 |
+
jsonOutput.textContent = JSON.stringify(data, null, 2);
|
| 73 |
+
}
|
| 74 |
+
})
|
| 75 |
+
.catch(error => {
|
| 76 |
+
loading.style.display = 'none';
|
| 77 |
+
summaryContainer.style.display = 'block';
|
| 78 |
+
jsonOutput.textContent = `Error: ${error.message}`;
|
| 79 |
+
});
|
| 80 |
+
});
|
| 81 |
+
</script>
|
| 82 |
+
</body>
|
| 83 |
+
</html>
|