Update index.html
Browse files- index.html +11 -12
index.html
CHANGED
|
@@ -78,16 +78,16 @@
|
|
| 78 |
|
| 79 |
<div class="card">
|
| 80 |
<h1>🤖 Yapay Zeka Asistanı</h1>
|
| 81 |
-
<p>
|
| 82 |
<textarea id="userInput" placeholder="Örn: Merhaba, nasılsın?"></textarea>
|
| 83 |
-
<button id="btn" onclick="askAI()">
|
| 84 |
<div class="response" id="output">Yanıt burada görünecek...</div>
|
| 85 |
</div>
|
| 86 |
|
| 87 |
<script type="module">
|
| 88 |
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.14.0';
|
| 89 |
|
| 90 |
-
let
|
| 91 |
|
| 92 |
window.askAI = async function() {
|
| 93 |
const prompt = document.getElementById('userInput').value;
|
|
@@ -95,24 +95,23 @@
|
|
| 95 |
const btn = document.getElementById('btn');
|
| 96 |
|
| 97 |
if (!prompt.trim()) {
|
| 98 |
-
output.innerText = "Lütfen bir
|
| 99 |
return;
|
| 100 |
}
|
| 101 |
|
| 102 |
try {
|
| 103 |
btn.disabled = true;
|
| 104 |
|
| 105 |
-
if (!
|
| 106 |
-
output.innerText = "
|
| 107 |
-
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
-
output.innerText = "
|
| 111 |
|
| 112 |
-
const result = await
|
| 113 |
-
max_new_tokens:
|
| 114 |
-
temperature: 0.5,
|
| 115 |
-
repetition_penalty: 2.0 // Kelime tekrarlarını önleyen ayar
|
| 116 |
});
|
| 117 |
|
| 118 |
output.innerText = result[0].generated_text;
|
|
|
|
| 78 |
|
| 79 |
<div class="card">
|
| 80 |
<h1>🤖 Yapay Zeka Asistanı</h1>
|
| 81 |
+
<p>Sohbet etmek için bir şeyler yazın:</p>
|
| 82 |
<textarea id="userInput" placeholder="Örn: Merhaba, nasılsın?"></textarea>
|
| 83 |
+
<button id="btn" onclick="askAI()">Gönder</button>
|
| 84 |
<div class="response" id="output">Yanıt burada görünecek...</div>
|
| 85 |
</div>
|
| 86 |
|
| 87 |
<script type="module">
|
| 88 |
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.14.0';
|
| 89 |
|
| 90 |
+
let summarizer = null;
|
| 91 |
|
| 92 |
window.askAI = async function() {
|
| 93 |
const prompt = document.getElementById('userInput').value;
|
|
|
|
| 95 |
const btn = document.getElementById('btn');
|
| 96 |
|
| 97 |
if (!prompt.trim()) {
|
| 98 |
+
output.innerText = "Lütfen bir şeyler yazın!";
|
| 99 |
return;
|
| 100 |
}
|
| 101 |
|
| 102 |
try {
|
| 103 |
btn.disabled = true;
|
| 104 |
|
| 105 |
+
if (!summarizer) {
|
| 106 |
+
output.innerText = "Yapay zeka modeli hazırlanıyor, ilk açılışta biraz sürebilir...";
|
| 107 |
+
// Türkçe destekli ve daha kararlı bir model seçiyoruz
|
| 108 |
+
summarizer = await pipeline('text2text-generation', 'Xenova/flan-t5-small');
|
| 109 |
}
|
| 110 |
|
| 111 |
+
output.innerText = "Cevap yazılıyor...";
|
| 112 |
|
| 113 |
+
const result = await summarizer(prompt, {
|
| 114 |
+
max_new_tokens: 100
|
|
|
|
|
|
|
| 115 |
});
|
| 116 |
|
| 117 |
output.innerText = result[0].generated_text;
|