Spaces:
Sleeping
Sleeping
Update templates/pure_predictor.html
Browse files- templates/pure_predictor.html +163 -163
templates/pure_predictor.html
CHANGED
|
@@ -1,163 +1,163 @@
|
|
| 1 |
-
{% extends "base.html" %}
|
| 2 |
-
{% block content %}
|
| 3 |
-
|
| 4 |
-
<div class="container py-4">
|
| 5 |
-
|
| 6 |
-
<!-- Page title -->
|
| 7 |
-
<h2 class="fw-bold mb-3">Pure Fuel
|
| 8 |
-
<p class="text-muted">Enter one or more pure fuels using IUPAC names or SMILES
|
| 9 |
-
|
| 10 |
-
<!-- Input form card -->
|
| 11 |
-
<div class="card card-metric p-4 mb-4">
|
| 12 |
-
|
| 13 |
-
<h4 class="fw-bold mb-3">Input Pure Fuel Candidates</h4>
|
| 14 |
-
|
| 15 |
-
<form method="POST">
|
| 16 |
-
|
| 17 |
-
<!-- Fuel input -->
|
| 18 |
-
<div id="fuel-container">
|
| 19 |
-
|
| 20 |
-
<div class="row g-3 mb-3 fuel-row">
|
| 21 |
-
<div class="col-md-6">
|
| 22 |
-
<input type="text" name="fuel_name[]" class="form-control"
|
| 23 |
-
placeholder="Fuel IUPAC Name (ex. decane)">
|
| 24 |
-
</div>
|
| 25 |
-
|
| 26 |
-
<div class="col-md-6">
|
| 27 |
-
<input type="text" name="smiles[]" class="form-control"
|
| 28 |
-
placeholder="SMILES (ex. CCCCCCCCCC)">
|
| 29 |
-
</div>
|
| 30 |
-
</div>
|
| 31 |
-
|
| 32 |
-
</div>
|
| 33 |
-
|
| 34 |
-
<!-- Add more row -->
|
| 35 |
-
<button type="button" id="add-row" class="btn btn-primary mb-3">
|
| 36 |
-
+ Add Another Fuel
|
| 37 |
-
</button>
|
| 38 |
-
|
| 39 |
-
<br>
|
| 40 |
-
|
| 41 |
-
<!-- Submit button -->
|
| 42 |
-
<button type="submit" class="btn btn-primary px-4 mt-2">
|
| 43 |
-
Predict
|
| 44 |
-
</button>
|
| 45 |
-
|
| 46 |
-
</form>
|
| 47 |
-
</div>
|
| 48 |
-
|
| 49 |
-
<!-- Bulk CSV Upload Section -->
|
| 50 |
-
<div class="card card-metric p-4 mb-4">
|
| 51 |
-
|
| 52 |
-
<h4 class="fw-bold mb-3">Bulk Prediction (CSV Upload)</h4>
|
| 53 |
-
<p class="text-muted">Upload a CSV file with columns <strong>SMILES</strong> and <strong>IUPAC names</strong>.</p>
|
| 54 |
-
|
| 55 |
-
<form method="POST" enctype="multipart/form-data">
|
| 56 |
-
<div class="mb-3">
|
| 57 |
-
<input type="file" name="csv_file" accept=".csv" class="form-control">
|
| 58 |
-
</div>
|
| 59 |
-
|
| 60 |
-
<button type="submit" name="mode" value="csv" class="btn btn-primary">
|
| 61 |
-
Upload & Predict CSV
|
| 62 |
-
</button>
|
| 63 |
-
</form>
|
| 64 |
-
|
| 65 |
-
</div>
|
| 66 |
-
|
| 67 |
-
<!-- Results Section -->
|
| 68 |
-
{% if results %}
|
| 69 |
-
<div class="card card-metric p-4 mt-4">
|
| 70 |
-
|
| 71 |
-
<h4 class="fw-bold mb-3">Prediction Results</h4>
|
| 72 |
-
|
| 73 |
-
<table class="table table-striped table-bordered mt-3">
|
| 74 |
-
<thead>
|
| 75 |
-
<tr>
|
| 76 |
-
<th>Name</th>
|
| 77 |
-
<th>SMILES</th>
|
| 78 |
-
<th>Predicted DCN</th>
|
| 79 |
-
<th>Predicted YSI</th>
|
| 80 |
-
<th>Structure</th>
|
| 81 |
-
<th>Status</th>
|
| 82 |
-
</tr>
|
| 83 |
-
</thead>
|
| 84 |
-
|
| 85 |
-
<tbody>
|
| 86 |
-
{% for r in results %}
|
| 87 |
-
<tr>
|
| 88 |
-
<td>{{ r.name }}</td>
|
| 89 |
-
<td>{{ r.smiles }}</td>
|
| 90 |
-
<td>
|
| 91 |
-
{% if r.dcn %}<strong>{{ r.dcn }}</strong>{% else %}-{% endif %}
|
| 92 |
-
</td>
|
| 93 |
-
<td>
|
| 94 |
-
{% if r.ysi %}<strong>{{ r.ysi }}</strong>{% else %}-{% endif %}
|
| 95 |
-
</td>
|
| 96 |
-
|
| 97 |
-
<td>
|
| 98 |
-
{% if r.img_id %}
|
| 99 |
-
<img src="{{ url_for('static', filename='generated/' ~ r.img_id) }}" width="120">
|
| 100 |
-
{% else %}
|
| 101 |
-
-
|
| 102 |
-
{% endif %}
|
| 103 |
-
</td>
|
| 104 |
-
|
| 105 |
-
<td>
|
| 106 |
-
{% if r.error %}
|
| 107 |
-
<span class="text-danger">{{ r.error }}</span>
|
| 108 |
-
{% else %}
|
| 109 |
-
<span class="text-success fw-bold">OK</span>
|
| 110 |
-
{% endif %}
|
| 111 |
-
</td>
|
| 112 |
-
</tr>
|
| 113 |
-
{% endfor %}
|
| 114 |
-
</tbody>
|
| 115 |
-
|
| 116 |
-
</table>
|
| 117 |
-
|
| 118 |
-
<!-- Download CSV -->
|
| 119 |
-
<form method="POST" action="{{ url_for('download_results') }}">
|
| 120 |
-
<input type="hidden" name="results_data" value='{{ results | tojson }}'>
|
| 121 |
-
<button type="submit" class="btn btn-primary mt-3">
|
| 122 |
-
⬇️ Download Results as CSV
|
| 123 |
-
</button>
|
| 124 |
-
</form>
|
| 125 |
-
|
| 126 |
-
</div>
|
| 127 |
-
{% endif %}
|
| 128 |
-
|
| 129 |
-
</div>
|
| 130 |
-
|
| 131 |
-
<!-- JavaScript to dynamically add ONLY new rows -->
|
| 132 |
-
<script>
|
| 133 |
-
document.addEventListener("DOMContentLoaded", function () {
|
| 134 |
-
|
| 135 |
-
const container = document.getElementById("fuel-container");
|
| 136 |
-
const addRowBtn = document.getElementById("add-row");
|
| 137 |
-
|
| 138 |
-
addRowBtn.addEventListener("click", function () {
|
| 139 |
-
|
| 140 |
-
const row = document.createElement("div");
|
| 141 |
-
row.classList.add("row", "g-3", "mb-3", "fuel-row");
|
| 142 |
-
|
| 143 |
-
row.innerHTML = `
|
| 144 |
-
<div class="col-md-6">
|
| 145 |
-
<input type="text" name="fuel_name[]" class="form-control"
|
| 146 |
-
placeholder="Fuel IUPAC Name (ex. decane)">
|
| 147 |
-
</div>
|
| 148 |
-
|
| 149 |
-
<div class="col-md-6">
|
| 150 |
-
<input type="text" name="smiles[]" class="form-control"
|
| 151 |
-
placeholder="SMILES (ex. CCCCCCCCCC)">
|
| 152 |
-
</div>
|
| 153 |
-
`;
|
| 154 |
-
|
| 155 |
-
container.appendChild(row);
|
| 156 |
-
});
|
| 157 |
-
|
| 158 |
-
});
|
| 159 |
-
</script>
|
| 160 |
-
|
| 161 |
-
{% endblock %}
|
| 162 |
-
|
| 163 |
-
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
| 2 |
+
{% block content %}
|
| 3 |
+
|
| 4 |
+
<div class="container py-4">
|
| 5 |
+
|
| 6 |
+
<!-- Page title -->
|
| 7 |
+
<h2 class="fw-bold mb-3">Pure Fuel DCN and YSI Predictor</h2>
|
| 8 |
+
<p class="text-muted">Enter one or more pure fuels using IUPAC names or SMILES.</p>
|
| 9 |
+
|
| 10 |
+
<!-- Input form card -->
|
| 11 |
+
<div class="card card-metric p-4 mb-4">
|
| 12 |
+
|
| 13 |
+
<h4 class="fw-bold mb-3">Input Pure Fuel Candidates</h4>
|
| 14 |
+
|
| 15 |
+
<form method="POST">
|
| 16 |
+
|
| 17 |
+
<!-- Fuel input -->
|
| 18 |
+
<div id="fuel-container">
|
| 19 |
+
|
| 20 |
+
<div class="row g-3 mb-3 fuel-row">
|
| 21 |
+
<div class="col-md-6">
|
| 22 |
+
<input type="text" name="fuel_name[]" class="form-control"
|
| 23 |
+
placeholder="Fuel IUPAC Name (ex. decane)">
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<div class="col-md-6">
|
| 27 |
+
<input type="text" name="smiles[]" class="form-control"
|
| 28 |
+
placeholder="SMILES (ex. CCCCCCCCCC)">
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<!-- Add more row -->
|
| 35 |
+
<button type="button" id="add-row" class="btn btn-primary mb-3">
|
| 36 |
+
+ Add Another Fuel
|
| 37 |
+
</button>
|
| 38 |
+
|
| 39 |
+
<br>
|
| 40 |
+
|
| 41 |
+
<!-- Submit button -->
|
| 42 |
+
<button type="submit" class="btn btn-primary px-4 mt-2">
|
| 43 |
+
Predict
|
| 44 |
+
</button>
|
| 45 |
+
|
| 46 |
+
</form>
|
| 47 |
+
</div>
|
| 48 |
+
|
| 49 |
+
<!-- Bulk CSV Upload Section -->
|
| 50 |
+
<div class="card card-metric p-4 mb-4">
|
| 51 |
+
|
| 52 |
+
<h4 class="fw-bold mb-3">Bulk Prediction (CSV Upload)</h4>
|
| 53 |
+
<p class="text-muted">Upload a CSV file with columns <strong>SMILES</strong> and <strong>IUPAC names</strong>.</p>
|
| 54 |
+
|
| 55 |
+
<form method="POST" enctype="multipart/form-data">
|
| 56 |
+
<div class="mb-3">
|
| 57 |
+
<input type="file" name="csv_file" accept=".csv" class="form-control">
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<button type="submit" name="mode" value="csv" class="btn btn-primary">
|
| 61 |
+
Upload & Predict CSV
|
| 62 |
+
</button>
|
| 63 |
+
</form>
|
| 64 |
+
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<!-- Results Section -->
|
| 68 |
+
{% if results %}
|
| 69 |
+
<div class="card card-metric p-4 mt-4">
|
| 70 |
+
|
| 71 |
+
<h4 class="fw-bold mb-3">Prediction Results</h4>
|
| 72 |
+
|
| 73 |
+
<table class="table table-striped table-bordered mt-3">
|
| 74 |
+
<thead>
|
| 75 |
+
<tr>
|
| 76 |
+
<th>Name</th>
|
| 77 |
+
<th>SMILES</th>
|
| 78 |
+
<th>Predicted DCN</th>
|
| 79 |
+
<th>Predicted YSI</th>
|
| 80 |
+
<th>Structure</th>
|
| 81 |
+
<th>Status</th>
|
| 82 |
+
</tr>
|
| 83 |
+
</thead>
|
| 84 |
+
|
| 85 |
+
<tbody>
|
| 86 |
+
{% for r in results %}
|
| 87 |
+
<tr>
|
| 88 |
+
<td>{{ r.name }}</td>
|
| 89 |
+
<td>{{ r.smiles }}</td>
|
| 90 |
+
<td>
|
| 91 |
+
{% if r.dcn %}<strong>{{ r.dcn }}</strong>{% else %}-{% endif %}
|
| 92 |
+
</td>
|
| 93 |
+
<td>
|
| 94 |
+
{% if r.ysi %}<strong>{{ r.ysi }}</strong>{% else %}-{% endif %}
|
| 95 |
+
</td>
|
| 96 |
+
|
| 97 |
+
<td>
|
| 98 |
+
{% if r.img_id %}
|
| 99 |
+
<img src="{{ url_for('static', filename='generated/' ~ r.img_id) }}" width="120">
|
| 100 |
+
{% else %}
|
| 101 |
+
-
|
| 102 |
+
{% endif %}
|
| 103 |
+
</td>
|
| 104 |
+
|
| 105 |
+
<td>
|
| 106 |
+
{% if r.error %}
|
| 107 |
+
<span class="text-danger">{{ r.error }}</span>
|
| 108 |
+
{% else %}
|
| 109 |
+
<span class="text-success fw-bold">OK</span>
|
| 110 |
+
{% endif %}
|
| 111 |
+
</td>
|
| 112 |
+
</tr>
|
| 113 |
+
{% endfor %}
|
| 114 |
+
</tbody>
|
| 115 |
+
|
| 116 |
+
</table>
|
| 117 |
+
|
| 118 |
+
<!-- Download CSV -->
|
| 119 |
+
<form method="POST" action="{{ url_for('download_results') }}">
|
| 120 |
+
<input type="hidden" name="results_data" value='{{ results | tojson }}'>
|
| 121 |
+
<button type="submit" class="btn btn-primary mt-3">
|
| 122 |
+
⬇️ Download Results as CSV
|
| 123 |
+
</button>
|
| 124 |
+
</form>
|
| 125 |
+
|
| 126 |
+
</div>
|
| 127 |
+
{% endif %}
|
| 128 |
+
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<!-- JavaScript to dynamically add ONLY new rows -->
|
| 132 |
+
<script>
|
| 133 |
+
document.addEventListener("DOMContentLoaded", function () {
|
| 134 |
+
|
| 135 |
+
const container = document.getElementById("fuel-container");
|
| 136 |
+
const addRowBtn = document.getElementById("add-row");
|
| 137 |
+
|
| 138 |
+
addRowBtn.addEventListener("click", function () {
|
| 139 |
+
|
| 140 |
+
const row = document.createElement("div");
|
| 141 |
+
row.classList.add("row", "g-3", "mb-3", "fuel-row");
|
| 142 |
+
|
| 143 |
+
row.innerHTML = `
|
| 144 |
+
<div class="col-md-6">
|
| 145 |
+
<input type="text" name="fuel_name[]" class="form-control"
|
| 146 |
+
placeholder="Fuel IUPAC Name (ex. decane)">
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<div class="col-md-6">
|
| 150 |
+
<input type="text" name="smiles[]" class="form-control"
|
| 151 |
+
placeholder="SMILES (ex. CCCCCCCCCC)">
|
| 152 |
+
</div>
|
| 153 |
+
`;
|
| 154 |
+
|
| 155 |
+
container.appendChild(row);
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
});
|
| 159 |
+
</script>
|
| 160 |
+
|
| 161 |
+
{% endblock %}
|
| 162 |
+
|
| 163 |
+
|