Spaces:
Sleeping
Sleeping
Nrup Parikh
commited on
Commit
·
ab7df0f
1
Parent(s):
7713563
added loader
Browse files
app.py
CHANGED
|
@@ -174,87 +174,86 @@ def index():
|
|
| 174 |
|
| 175 |
return render_template_string(
|
| 176 |
"""
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
<div
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
</div>
|
| 223 |
-
<div class="col-md-2">
|
| 224 |
-
<button type="submit" class="btn btn-primary w-100">Predict</button>
|
| 225 |
-
</div>
|
| 226 |
</div>
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
{% if result %}
|
| 230 |
-
<div class="card result-card shadow">
|
| 231 |
-
<div class="card-body">
|
| 232 |
-
<h5 class="card-title text-center">Report for {{ result.symbol }}</h5>
|
| 233 |
-
<p><b>Trend:</b> {{ result.trend }}</p>
|
| 234 |
-
<p><b>Current Price:</b> ₹{{ result.current_price }} ({{ result.date_now }})</p>
|
| 235 |
-
<p><b>Predicted Price (Next 30 Days):</b> ₹{{ result.predicted_price }} ({{ result.future_date }})</p>
|
| 236 |
-
<p><b>Price Difference:</b> ₹{{ result.price_difference }}</p>
|
| 237 |
-
<p><b>Expected Return:</b> {{ result.profit_or_loss }}</p>
|
| 238 |
-
<p><b>Entry Price:</b> {{ result.entry_price }}</p>
|
| 239 |
-
<p><b>Stop Loss:</b> {{ result.stop_loss }}</p>
|
| 240 |
</div>
|
| 241 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
</div>
|
| 247 |
-
{% endif %}
|
| 248 |
</div>
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
</
|
| 257 |
-
</
|
|
|
|
| 258 |
""",
|
| 259 |
stocks=stocks,
|
| 260 |
result=result,
|
|
|
|
| 174 |
|
| 175 |
return render_template_string(
|
| 176 |
"""
|
| 177 |
+
<html>
|
| 178 |
+
<head>
|
| 179 |
+
<title>Stock Predictor</title>
|
| 180 |
+
<link rel="stylesheet"
|
| 181 |
+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
| 182 |
+
<style>
|
| 183 |
+
body { padding: 30px; }
|
| 184 |
+
th, td { text-align: center; }
|
| 185 |
+
.result-card { margin-top: 40px; }
|
| 186 |
+
|
| 187 |
+
/* Loader overlay */
|
| 188 |
+
#loader-overlay {
|
| 189 |
+
display: none;
|
| 190 |
+
position: fixed;
|
| 191 |
+
top: 0;
|
| 192 |
+
left: 0;
|
| 193 |
+
width: 100%;
|
| 194 |
+
height: 100%;
|
| 195 |
+
background: rgba(255, 255, 255, 0.8);
|
| 196 |
+
z-index: 9999;
|
| 197 |
+
justify-content: center;
|
| 198 |
+
align-items: center;
|
| 199 |
+
flex-direction: column;
|
| 200 |
+
}
|
| 201 |
+
</style>
|
| 202 |
+
</head>
|
| 203 |
+
<body>
|
| 204 |
+
<div id="loader-overlay">
|
| 205 |
+
<div class="spinner-border text-primary" role="status" style="width: 4rem; height: 4rem;"></div>
|
| 206 |
+
<p class="mt-3 fw-bold text-primary">Predicting... Please wait</p>
|
| 207 |
+
</div>
|
| 208 |
+
|
| 209 |
+
<div class="container">
|
| 210 |
+
<h3 class="text-center mb-4">Stock Prediction Dashboard</h3>
|
| 211 |
+
<form method="POST" class="text-center mb-4" onsubmit="showLoader()">
|
| 212 |
+
<div class="row justify-content-center">
|
| 213 |
+
<div class="col-md-4">
|
| 214 |
+
<select name="symbol" class="form-select">
|
| 215 |
+
{% for name, sym in stocks.items() %}
|
| 216 |
+
<option value="{{ sym }}"
|
| 217 |
+
{% if result and result.symbol == sym %}selected{% endif %}>
|
| 218 |
+
{{ name }} ({{ sym }})
|
| 219 |
+
</option>
|
| 220 |
+
{% endfor %}
|
| 221 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
</div>
|
| 223 |
+
<div class="col-md-2">
|
| 224 |
+
<button type="submit" class="btn btn-primary w-100">Predict</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
</div>
|
| 226 |
</div>
|
| 227 |
+
</form>
|
| 228 |
+
|
| 229 |
+
{% if result %}
|
| 230 |
+
<div class="card result-card shadow">
|
| 231 |
+
<div class="card-body">
|
| 232 |
+
<h5 class="card-title text-center">Report for {{ result.symbol }}</h5>
|
| 233 |
+
<p><b>Trend:</b> {{ result.trend }}</p>
|
| 234 |
+
<p><b>Current Price:</b> ₹{{ result.current_price }} ({{ result.date_now }})</p>
|
| 235 |
+
<p><b>Predicted Price (Next 30 Days):</b> ₹{{ result.predicted_price }} ({{ result.future_date }})</p>
|
| 236 |
+
<p><b>Price Difference:</b> ₹{{ result.price_difference }}</p>
|
| 237 |
+
<p><b>Expected Return:</b> {{ result.profit_or_loss }}</p>
|
| 238 |
+
<p><b>Entry Price:</b> {{ result.entry_price }}</p>
|
| 239 |
+
<p><b>Stop Loss:</b> {{ result.stop_loss }}</p>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
|
| 243 |
+
<div class="mt-4">
|
| 244 |
+
<h5>Last 30 Days Data</h5>
|
| 245 |
+
{{ table_html | safe }}
|
|
|
|
|
|
|
| 246 |
</div>
|
| 247 |
+
{% endif %}
|
| 248 |
+
</div>
|
| 249 |
+
|
| 250 |
+
<script>
|
| 251 |
+
function showLoader() {
|
| 252 |
+
document.getElementById("loader-overlay").style.display = "flex";
|
| 253 |
+
}
|
| 254 |
+
</script>
|
| 255 |
+
</body>
|
| 256 |
+
</html>
|
| 257 |
""",
|
| 258 |
stocks=stocks,
|
| 259 |
result=result,
|