MASTERYZ commited on
Commit
c806237
·
verified ·
1 Parent(s): b0b319e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +11 -12
index.html CHANGED
@@ -78,16 +78,16 @@
78
 
79
  <div class="card">
80
  <h1>🤖 Yapay Zeka Asistanı</h1>
81
- <p>Sorunuzu veya cümlenizi yazın:</p>
82
  <textarea id="userInput" placeholder="Örn: Merhaba, nasılsın?"></textarea>
83
- <button id="btn" onclick="askAI()">Yapay Zekaya Sor</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 generator = null;
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 metin girin!";
99
  return;
100
  }
101
 
102
  try {
103
  btn.disabled = true;
104
 
105
- if (!generator) {
106
- output.innerText = "Model yükleniyor, lütfen bekleyin...";
107
- generator = await pipeline('text-generation', 'Xenova/gpt2');
 
108
  }
109
 
110
- output.innerText = "Yapay zeka düşünüyor...";
111
 
112
- const result = await generator(prompt, {
113
- max_new_tokens: 40,
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;