MASTERAI / index.html
MASTERYZ's picture
Update index.html
c806237 verified
Raw History Blame Contribute Delete
3.78 kB
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Benim YZ Asistanım</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #0f172a;
color: #f8fafc;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
}
.card {
background-color: #1e293b;
padding: 30px;
border-radius: 12px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
max-width: 500px;
width: 90%;
text-align: center;
}
h1 {
color: #38bdf8;
margin-bottom: 20px;
}
textarea {
width: 100%;
height: 100px;
padding: 12px;
border-radius: 8px;
border: 1px solid #334155;
background-color: #0f172a;
color: #fff;
resize: none;
box-sizing: border-box;
font-size: 14px;
}
button {
margin-top: 15px;
width: 100%;
padding: 12px;
background-color: #0284c7;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background-color: #0369a1;
}
button:disabled {
background-color: #475569;
cursor: not-allowed;
}
.response {
margin-top: 20px;
padding: 15px;
background-color: #0f172a;
border-radius: 8px;
text-align: left;
min-height: 50px;
white-space: pre-wrap;
border: 1px solid #334155;
font-size: 14px;
line-height: 1.5;
}
</style>
</head>
<body>
<div class="card">
<h1>🤖 Yapay Zeka Asistanı</h1>
<p>Sohbet etmek için bir şeyler yazın:</p>
<textarea id="userInput" placeholder="Örn: Merhaba, nasılsın?"></textarea>
<button id="btn" onclick="askAI()">Gönder</button>
<div class="response" id="output">Yanıt burada görünecek...</div>
</div>
<script type="module">
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.14.0';
let summarizer = null;
window.askAI = async function() {
const prompt = document.getElementById('userInput').value;
const output = document.getElementById('output');
const btn = document.getElementById('btn');
if (!prompt.trim()) {
output.innerText = "Lütfen bir şeyler yazın!";
return;
}
try {
btn.disabled = true;
if (!summarizer) {
output.innerText = "Yapay zeka modeli hazırlanıyor, ilk açılışta biraz sürebilir...";
// Türkçe destekli ve daha kararlı bir model seçiyoruz
summarizer = await pipeline('text2text-generation', 'Xenova/flan-t5-small');
}
output.innerText = "Cevap yazılıyor...";
const result = await summarizer(prompt, {
max_new_tokens: 100
});
output.innerText = result[0].generated_text;
} catch (error) {
output.innerText = "Hata oluştu: " + error.message;
} finally {
btn.disabled = false;
}
}
</script>
</body>
</html>