triflix's picture
Create templates/index.html
823a130 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Disable caching -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<!-- Tailwind CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<title>Triangle AI Logo Generator</title>
</head>
<body class="bg-gray-100 flex items-center justify-center min-h-screen p-4">
<div class="bg-white p-6 rounded-2xl shadow-lg w-full max-w-md">
<h1 class="text-2xl font-bold mb-4">Triangle AI Logo Generator</h1>
<form action="/generate" method="post" class="space-y-4">
<textarea name="prompt" rows="4" required
class="w-full p-2 border rounded focus:outline-none focus:ring"
placeholder="Enter your prompt here">{{ prompt or '' }}</textarea>
<button type="submit" class="w-full p-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Generate</button>
</form>
{% if image_url %}
<div class="mt-6">
<p class="font-medium">Result URL:</p>
<a href="{{ image_url }}" target="_blank" class="text-blue-600 break-all">{{ image_url }}</a>
<iframe src="{{ image_url }}" class="w-full h-64 mt-4 border rounded"></iframe>
</div>
{% endif %}
{% if error %}
<div class="mt-6 text-red-600">
<p>Error: {{ error }}</p>
<button onclick="clearCache()" class="mt-2 p-2 bg-red-500 text-white rounded">
Clear Cache & Reload</button>
</div>
{% endif %}
</div>
<script>
function clearCache() {
// Clear service worker caches
if (window.caches) {
caches.keys().then(names => names.forEach(name => caches.delete(name)))
.finally(() => location.reload());
} else {
location.reload();
}
}
</script>
</body>
</html>