Spaces:
Running
Running
Create a full-stack website called "SmartTrade Signals" that analyzes uploaded trading chart images and returns trading signals like Buy/Sell, Stoploss, and Take Profit. 🔧 Features Required: 1. **Frontend UI** - Header: "SmartTrade Signals" - Subheading: "Upload your chart and get instant trade signals." - Upload box for image files (drag & drop + browse) - Analyze button - Output box to display: - Signal: BUY / SELL - Stoploss: ₹xxxx.xx - Take Profit: ₹xxxx.xx - Clean, dark theme UI with neon green accents - Fully mobile responsive 2. **Backend Logic** - Use Python (Flask or FastAPI) as backend - When an image is uploaded, simulate analysis by returning a JSON like: ```json { "signal": "BUY", "stoploss": "1835.50", "take_profit": "1878.90" } - Initial Deployment
Browse files- README.md +7 -5
- index.html +396 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: chart
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,396 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.0">
|
| 6 |
+
<title>SmartTrade Signals - AI Trading Analysis</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Poppins:wght@300;400;500;600&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Poppins', sans-serif;
|
| 14 |
+
background-color: #0a0a0a;
|
| 15 |
+
color: #e2e8f0;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.header-font {
|
| 19 |
+
font-family: 'Orbitron', sans-serif;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.dropzone {
|
| 23 |
+
border: 2px dashed #4ade80;
|
| 24 |
+
transition: all 0.3s ease;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.dropzone.active {
|
| 28 |
+
border-color: #22c55e;
|
| 29 |
+
background-color: rgba(74, 222, 128, 0.05);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.signal-buy {
|
| 33 |
+
background-color: rgba(74, 222, 128, 0.1);
|
| 34 |
+
border-left: 4px solid #4ade80;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.signal-sell {
|
| 38 |
+
background-color: rgba(239, 68, 68, 0.1);
|
| 39 |
+
border-left: 4px solid #ef4444;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.glow {
|
| 43 |
+
text-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.pulse {
|
| 47 |
+
animation: pulse 2s infinite;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% {
|
| 52 |
+
box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
|
| 53 |
+
}
|
| 54 |
+
70% {
|
| 55 |
+
box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
|
| 56 |
+
}
|
| 57 |
+
100% {
|
| 58 |
+
box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
</style>
|
| 62 |
+
</head>
|
| 63 |
+
<body class="min-h-screen flex flex-col">
|
| 64 |
+
<!-- Header -->
|
| 65 |
+
<header class="bg-gray-900 border-b border-gray-800 py-6 px-4">
|
| 66 |
+
<div class="container mx-auto flex flex-col md:flex-row justify-between items-center">
|
| 67 |
+
<div class="flex items-center mb-4 md:mb-0">
|
| 68 |
+
<div class="w-10 h-10 rounded-full bg-green-500 flex items-center justify-center mr-3">
|
| 69 |
+
<i class="fas fa-chart-line text-white"></i>
|
| 70 |
+
</div>
|
| 71 |
+
<h1 class="header-font text-2xl md:text-3xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-green-400 to-green-600 glow">
|
| 72 |
+
SmartTrade Signals
|
| 73 |
+
</h1>
|
| 74 |
+
</div>
|
| 75 |
+
<nav class="flex space-x-6">
|
| 76 |
+
<a href="#" class="text-gray-400 hover:text-green-400 transition">Home</a>
|
| 77 |
+
<a href="#" class="text-gray-400 hover:text-green-400 transition">How It Works</a>
|
| 78 |
+
<a href="#" class="text-gray-400 hover:text-green-400 transition">Pricing</a>
|
| 79 |
+
<a href="#" class="text-gray-400 hover:text-green-400 transition">Contact</a>
|
| 80 |
+
</nav>
|
| 81 |
+
</div>
|
| 82 |
+
</header>
|
| 83 |
+
|
| 84 |
+
<!-- Main Content -->
|
| 85 |
+
<main class="flex-grow container mx-auto px-4 py-8 md:py-12">
|
| 86 |
+
<div class="max-w-4xl mx-auto text-center mb-10">
|
| 87 |
+
<h2 class="header-font text-3xl md:text-4xl font-bold mb-4">Upload your chart and get instant trade signals</h2>
|
| 88 |
+
<p class="text-gray-400 text-lg max-w-2xl mx-auto">
|
| 89 |
+
Our AI analyzes your trading charts in seconds to provide accurate BUY/SELL signals with precise stoploss and take profit levels.
|
| 90 |
+
</p>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
| 94 |
+
<!-- Upload Section -->
|
| 95 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg border border-gray-700">
|
| 96 |
+
<h3 class="header-font text-xl font-semibold mb-4 text-green-400 flex items-center">
|
| 97 |
+
<i class="fas fa-cloud-upload-alt mr-2"></i> Upload Chart
|
| 98 |
+
</h3>
|
| 99 |
+
|
| 100 |
+
<div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6">
|
| 101 |
+
<div class="flex flex-col items-center justify-center">
|
| 102 |
+
<i class="fas fa-image text-4xl text-green-400 mb-3"></i>
|
| 103 |
+
<p class="text-gray-300 mb-1">Drag & drop your trading chart here</p>
|
| 104 |
+
<p class="text-gray-500 text-sm">or</p>
|
| 105 |
+
<button id="browseBtn" class="mt-3 px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md transition">
|
| 106 |
+
Browse Files
|
| 107 |
+
</button>
|
| 108 |
+
</div>
|
| 109 |
+
<input type="file" id="fileInput" accept="image/*" class="hidden">
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<div id="previewContainer" class="hidden mb-6">
|
| 113 |
+
<div class="flex justify-between items-center mb-2">
|
| 114 |
+
<span class="text-gray-400">Selected file:</span>
|
| 115 |
+
<button id="removeFile" class="text-red-400 hover:text-red-300">
|
| 116 |
+
<i class="fas fa-times"></i> Remove
|
| 117 |
+
</button>
|
| 118 |
+
</div>
|
| 119 |
+
<div id="imagePreview" class="rounded-lg overflow-hidden border border-gray-700">
|
| 120 |
+
<!-- Preview will be inserted here -->
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<button id="analyzeBtn" class="w-full py-3 bg-green-600 hover:bg-green-700 text-white font-semibold rounded-lg transition flex items-center justify-center pulse">
|
| 125 |
+
<i class="fas fa-bolt mr-2"></i> Analyze Chart
|
| 126 |
+
</button>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<!-- Results Section -->
|
| 130 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg border border-gray-700">
|
| 131 |
+
<h3 class="header-font text-xl font-semibold mb-4 text-green-400 flex items-center">
|
| 132 |
+
<i class="fas fa-chart-bar mr-2"></i> Trading Signals
|
| 133 |
+
</h3>
|
| 134 |
+
|
| 135 |
+
<div id="resultsPlaceholder" class="bg-gray-900 rounded-lg p-8 text-center border border-dashed border-gray-700">
|
| 136 |
+
<i class="fas fa-chart-pie text-4xl text-gray-600 mb-4"></i>
|
| 137 |
+
<h4 class="text-gray-500 font-medium">Analysis Results</h4>
|
| 138 |
+
<p class="text-gray-600 text-sm mt-1">Upload a chart and click "Analyze" to get trading signals</p>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<div id="resultsContainer" class="hidden">
|
| 142 |
+
<div id="signalCard" class="rounded-lg p-5 mb-4">
|
| 143 |
+
<div class="flex justify-between items-center mb-2">
|
| 144 |
+
<span class="text-gray-400">Signal:</span>
|
| 145 |
+
<span id="signalValue" class="font-bold text-xl"></span>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 150 |
+
<div class="bg-gray-900 rounded-lg p-4 border border-gray-700">
|
| 151 |
+
<div class="flex justify-between items-center">
|
| 152 |
+
<span class="text-gray-400">Stoploss:</span>
|
| 153 |
+
<span id="stoplossValue" class="font-bold text-green-400"></span>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
|
| 157 |
+
<div class="bg-gray-900 rounded-lg p-4 border border-gray-700">
|
| 158 |
+
<div class="flex justify-between items-center">
|
| 159 |
+
<span class="text-gray-400">Take Profit:</span>
|
| 160 |
+
<span id="takeProfitValue" class="font-bold text-green-400"></span>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
<div class="mt-6 bg-gray-900 rounded-lg p-4 border border-gray-700">
|
| 166 |
+
<h4 class="text-gray-400 mb-2 flex items-center">
|
| 167 |
+
<i class="fas fa-lightbulb mr-2"></i> Analysis Summary
|
| 168 |
+
</h4>
|
| 169 |
+
<p id="analysisSummary" class="text-gray-300 text-sm"></p>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
<button id="saveBtn" class="w-full mt-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition flex items-center justify-center">
|
| 173 |
+
<i class="fas fa-save mr-2"></i> Save This Analysis
|
| 174 |
+
</button>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
</main>
|
| 179 |
+
|
| 180 |
+
<!-- Footer -->
|
| 181 |
+
<footer class="bg-gray-900 border-t border-gray-800 py-6 px-4">
|
| 182 |
+
<div class="container mx-auto">
|
| 183 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 184 |
+
<div class="mb-4 md:mb-0">
|
| 185 |
+
<p class="text-gray-500 text-sm">
|
| 186 |
+
© 2023 SmartTrade Signals. All rights reserved.
|
| 187 |
+
</p>
|
| 188 |
+
</div>
|
| 189 |
+
<div class="flex space-x-4">
|
| 190 |
+
<a href="#" class="text-gray-500 hover:text-green-400 transition">
|
| 191 |
+
<i class="fab fa-twitter"></i>
|
| 192 |
+
</a>
|
| 193 |
+
<a href="#" class="text-gray-500 hover:text-green-400 transition">
|
| 194 |
+
<i class="fab fa-telegram"></i>
|
| 195 |
+
</a>
|
| 196 |
+
<a href="#" class="text-gray-500 hover:text-green-400 transition">
|
| 197 |
+
<i class="fab fa-discord"></i>
|
| 198 |
+
</a>
|
| 199 |
+
<a href="#" class="text-gray-500 hover:text-green-400 transition">
|
| 200 |
+
<i class="fab fa-github"></i>
|
| 201 |
+
</a>
|
| 202 |
+
</div>
|
| 203 |
+
</div>
|
| 204 |
+
</div>
|
| 205 |
+
</footer>
|
| 206 |
+
|
| 207 |
+
<script>
|
| 208 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 209 |
+
const dropzone = document.getElementById('dropzone');
|
| 210 |
+
const fileInput = document.getElementById('fileInput');
|
| 211 |
+
const browseBtn = document.getElementById('browseBtn');
|
| 212 |
+
const removeFile = document.getElementById('removeFile');
|
| 213 |
+
const previewContainer = document.getElementById('previewContainer');
|
| 214 |
+
const imagePreview = document.getElementById('imagePreview');
|
| 215 |
+
const analyzeBtn = document.getElementById('analyzeBtn');
|
| 216 |
+
const resultsPlaceholder = document.getElementById('resultsPlaceholder');
|
| 217 |
+
const resultsContainer = document.getElementById('resultsContainer');
|
| 218 |
+
const signalValue = document.getElementById('signalValue');
|
| 219 |
+
const stoplossValue = document.getElementById('stoplossValue');
|
| 220 |
+
const takeProfitValue = document.getElementById('takeProfitValue');
|
| 221 |
+
const analysisSummary = document.getElementById('analysisSummary');
|
| 222 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 223 |
+
|
| 224 |
+
let currentFile = null;
|
| 225 |
+
|
| 226 |
+
// Drag and drop functionality
|
| 227 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
| 228 |
+
dropzone.addEventListener(eventName, preventDefaults, false);
|
| 229 |
+
});
|
| 230 |
+
|
| 231 |
+
function preventDefaults(e) {
|
| 232 |
+
e.preventDefault();
|
| 233 |
+
e.stopPropagation();
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
['dragenter', 'dragover'].forEach(eventName => {
|
| 237 |
+
dropzone.addEventListener(eventName, highlight, false);
|
| 238 |
+
});
|
| 239 |
+
|
| 240 |
+
['dragleave', 'drop'].forEach(eventName => {
|
| 241 |
+
dropzone.addEventListener(eventName, unhighlight, false);
|
| 242 |
+
});
|
| 243 |
+
|
| 244 |
+
function highlight() {
|
| 245 |
+
dropzone.classList.add('active');
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
function unhighlight() {
|
| 249 |
+
dropzone.classList.remove('active');
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
dropzone.addEventListener('drop', handleDrop, false);
|
| 253 |
+
|
| 254 |
+
function handleDrop(e) {
|
| 255 |
+
const dt = e.dataTransfer;
|
| 256 |
+
const files = dt.files;
|
| 257 |
+
handleFiles(files);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
browseBtn.addEventListener('click', () => {
|
| 261 |
+
fileInput.click();
|
| 262 |
+
});
|
| 263 |
+
|
| 264 |
+
fileInput.addEventListener('change', () => {
|
| 265 |
+
handleFiles(fileInput.files);
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
removeFile.addEventListener('click', () => {
|
| 269 |
+
currentFile = null;
|
| 270 |
+
previewContainer.classList.add('hidden');
|
| 271 |
+
fileInput.value = '';
|
| 272 |
+
});
|
| 273 |
+
|
| 274 |
+
function handleFiles(files) {
|
| 275 |
+
if (files.length > 0) {
|
| 276 |
+
currentFile = files[0];
|
| 277 |
+
previewContainer.classList.remove('hidden');
|
| 278 |
+
|
| 279 |
+
if (currentFile.type.startsWith('image/')) {
|
| 280 |
+
const reader = new FileReader();
|
| 281 |
+
reader.onload = function(e) {
|
| 282 |
+
imagePreview.innerHTML = `<img src="${e.target.result}" class="w-full h-auto max-h-64 object-contain" alt="Preview">`;
|
| 283 |
+
};
|
| 284 |
+
reader.readAsDataURL(currentFile);
|
| 285 |
+
} else {
|
| 286 |
+
imagePreview.innerHTML = `<div class="p-4 text-center text-gray-400"><i class="fas fa-file-alt text-3xl mb-2"></i><p>${currentFile.name}</p></div>`;
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
analyzeBtn.addEventListener('click', () => {
|
| 292 |
+
if (!currentFile) {
|
| 293 |
+
showAlert('Please upload a chart first', 'error');
|
| 294 |
+
return;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
// Show loading state
|
| 298 |
+
analyzeBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Analyzing...';
|
| 299 |
+
analyzeBtn.disabled = true;
|
| 300 |
+
|
| 301 |
+
// Simulate API call with timeout
|
| 302 |
+
setTimeout(() => {
|
| 303 |
+
// This would be replaced with actual API call to your Python backend
|
| 304 |
+
// For demo purposes, we'll generate random results
|
| 305 |
+
const results = generateRandomResults();
|
| 306 |
+
|
| 307 |
+
// Display results
|
| 308 |
+
displayResults(results);
|
| 309 |
+
|
| 310 |
+
// Reset button
|
| 311 |
+
analyzeBtn.innerHTML = '<i class="fas fa-bolt mr-2"></i> Analyze Chart';
|
| 312 |
+
analyzeBtn.disabled = false;
|
| 313 |
+
}, 2000);
|
| 314 |
+
});
|
| 315 |
+
|
| 316 |
+
function generateRandomResults() {
|
| 317 |
+
const signals = ['BUY', 'SELL'];
|
| 318 |
+
const randomSignal = signals[Math.floor(Math.random() * signals.length)];
|
| 319 |
+
|
| 320 |
+
// Generate random prices between 1000 and 2000 with 2 decimal places
|
| 321 |
+
const basePrice = (Math.random() * 1000 + 1000).toFixed(2);
|
| 322 |
+
const stoploss = (parseFloat(basePrice) * (randomSignal === 'BUY' ? 0.98 : 1.02)).toFixed(2);
|
| 323 |
+
const takeProfit = (parseFloat(basePrice) * (randomSignal === 'BUY' ? 1.05 : 0.95)).toFixed(2);
|
| 324 |
+
|
| 325 |
+
const summaries = [
|
| 326 |
+
"The chart shows a strong bullish breakout with increasing volume, suggesting a good buying opportunity.",
|
| 327 |
+
"Bearish divergence detected on RSI with price making higher highs while RSI makes lower highs, indicating potential reversal.",
|
| 328 |
+
"Price has bounced off key support level with confirmation from MACD crossover, suggesting upward momentum.",
|
| 329 |
+
"Head and shoulders pattern identified with neckline break, signaling potential downward movement.",
|
| 330 |
+
"Double bottom pattern confirmed with breakout above resistance, indicating bullish trend continuation."
|
| 331 |
+
];
|
| 332 |
+
|
| 333 |
+
const randomSummary = summaries[Math.floor(Math.random() * summaries.length)];
|
| 334 |
+
|
| 335 |
+
return {
|
| 336 |
+
signal: randomSignal,
|
| 337 |
+
stoploss: stoploss,
|
| 338 |
+
take_profit: takeProfit,
|
| 339 |
+
summary: randomSummary
|
| 340 |
+
};
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
function displayResults(results) {
|
| 344 |
+
resultsPlaceholder.classList.add('hidden');
|
| 345 |
+
resultsContainer.classList.remove('hidden');
|
| 346 |
+
|
| 347 |
+
signalValue.textContent = results.signal;
|
| 348 |
+
stoplossValue.textContent = `₹${results.stoploss}`;
|
| 349 |
+
takeProfitValue.textContent = `₹${results.take_profit}`;
|
| 350 |
+
analysisSummary.textContent = results.summary;
|
| 351 |
+
|
| 352 |
+
const signalCard = document.getElementById('signalCard');
|
| 353 |
+
signalCard.className = 'rounded-lg p-5 mb-4';
|
| 354 |
+
|
| 355 |
+
if (results.signal === 'BUY') {
|
| 356 |
+
signalCard.classList.add('signal-buy');
|
| 357 |
+
signalValue.className = 'font-bold text-xl text-green-400';
|
| 358 |
+
} else {
|
| 359 |
+
signalCard.classList.add('signal-sell');
|
| 360 |
+
signalValue.className = 'font-bold text-xl text-red-400';
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
saveBtn.addEventListener('click', () => {
|
| 365 |
+
if (!currentFile) {
|
| 366 |
+
showAlert('No analysis to save', 'error');
|
| 367 |
+
return;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
showAlert('Analysis saved successfully!', 'success');
|
| 371 |
+
});
|
| 372 |
+
|
| 373 |
+
function showAlert(message, type) {
|
| 374 |
+
const alert = document.createElement('div');
|
| 375 |
+
alert.className = `fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg z-50 ${
|
| 376 |
+
type === 'error' ? 'bg-red-600' : 'bg-green-600'
|
| 377 |
+
} text-white flex items-center`;
|
| 378 |
+
|
| 379 |
+
alert.innerHTML = `
|
| 380 |
+
<i class="fas ${type === 'error' ? 'fa-exclamation-circle' : 'fa-check-circle'} mr-2"></i>
|
| 381 |
+
${message}
|
| 382 |
+
`;
|
| 383 |
+
|
| 384 |
+
document.body.appendChild(alert);
|
| 385 |
+
|
| 386 |
+
setTimeout(() => {
|
| 387 |
+
alert.classList.add('opacity-0', 'transition-opacity', 'duration-300');
|
| 388 |
+
setTimeout(() => {
|
| 389 |
+
alert.remove();
|
| 390 |
+
}, 300);
|
| 391 |
+
}, 3000);
|
| 392 |
+
}
|
| 393 |
+
});
|
| 394 |
+
</script>
|
| 395 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Pankajpegu07/chart" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 396 |
+
</html>
|