veteroner
commited on
Commit
·
c856dba
1
Parent(s):
e48277d
Fix model path format for Hugging Face Spaces
Browse files- HF_Space_Files/README.md +0 -50
- HF_Space_Files/app.py +0 -345
- HF_Space_Files/requirements.txt +0 -5
- Nova_AI_Chat.ipynb +0 -268
- Nova_AI_Colab.py +0 -211
- README.md +1 -1
- README_HF.md +0 -50
- basit_konsol.py +175 -0
- baslat_basit_konsol.bat +50 -0
- baslat_gradio.bat +51 -0
- chat.html +0 -422
- download_mistral.py +0 -38
- gradio_app.py +1 -1
- hf_README.md +0 -50
- hf_app.py +0 -345
- hf_requirements.txt +0 -5
- hf_space_app.py +2 -2
- nova-ai-small/README.md +0 -243
- requirements-dev.txt +0 -39
- token_kurulum.bat +0 -42
HF_Space_Files/README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Nova AI
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.11.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# 🚀 Teknova Nova AI
|
| 14 |
-
|
| 15 |
-
**Özgün yapay zeka teknolojisi - Hugging Face Spaces'te canlı!**
|
| 16 |
-
|
| 17 |
-
## 🌟 Özellikler
|
| 18 |
-
|
| 19 |
-
- 🧠 **Gelişmiş Dil Modeli** - Teknova'nın özgün AI teknolojisi
|
| 20 |
-
- 💬 **Doğal Konuşma** - İnsan benzeri etkileşim
|
| 21 |
-
- 🌍 **Türkçe Optimizasyonu** - Ana dil Türkçe
|
| 22 |
-
- ⚡ **Hızlı Yanıt** - Optimize edilmiş performans
|
| 23 |
-
- 🎛️ **Ayarlanabilir Parametreler** - Temperature ve uzunluk kontrolü
|
| 24 |
-
|
| 25 |
-
## 🚀 Kullanım
|
| 26 |
-
|
| 27 |
-
1. **Mesajınızı yazın** - Text kutusuna sorunuzu girin
|
| 28 |
-
2. **Gönder** - Butona basın veya Enter'a basın
|
| 29 |
-
3. **Yanıt alın** - Nova AI'den hızlı yanıt
|
| 30 |
-
|
| 31 |
-
### 💡 Örnek Sorular
|
| 32 |
-
|
| 33 |
-
- "Merhaba Nova AI!"
|
| 34 |
-
- "Yapay zeka nedir?"
|
| 35 |
-
- "Teknova hakkında bilgi ver"
|
| 36 |
-
- "Bana proje fikirleri öner"
|
| 37 |
-
|
| 38 |
-
## ⚙️ Ayarlar
|
| 39 |
-
|
| 40 |
-
- **Maksimum Uzunluk**: Yanıtın uzunluğunu kontrol eder
|
| 41 |
-
- **Temperature**: Yaratıcılık seviyesi (0.1 = tutarlı, 1.2 = yaratıcı)
|
| 42 |
-
|
| 43 |
-
## 🔗 Linkler
|
| 44 |
-
|
| 45 |
-
- **GitHub**: [veteroner/novaai](https://github.com/veteroner/novaai)
|
| 46 |
-
- **Website**: [teknova.com](https://teknova.com)
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
**Made with ❤️ by Teknova**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HF_Space_Files/app.py
DELETED
|
@@ -1,345 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
🚀 Nova AI - Hugging Face Spaces
|
| 3 |
-
Teknova tarafından geliştirilen özgün yapay zeka modeli
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import gradio as gr
|
| 7 |
-
import torch
|
| 8 |
-
import os
|
| 9 |
-
import logging
|
| 10 |
-
import time
|
| 11 |
-
from typing import List, Tuple
|
| 12 |
-
|
| 13 |
-
# Logging setup
|
| 14 |
-
logging.basicConfig(level=logging.INFO)
|
| 15 |
-
logger = logging.getLogger(__name__)
|
| 16 |
-
|
| 17 |
-
# Global variables
|
| 18 |
-
model = None
|
| 19 |
-
tokenizer = None
|
| 20 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 21 |
-
|
| 22 |
-
def load_demo_responses():
|
| 23 |
-
"""
|
| 24 |
-
Demo yanıtları - model yokken kullanılacak
|
| 25 |
-
"""
|
| 26 |
-
demo_responses = {
|
| 27 |
-
"merhaba": "Merhaba! Ben Nova AI, Teknova'nın özgün yapay zeka teknolojisi. Size nasıl yardımcı olabilirim?",
|
| 28 |
-
"nasılsın": "Ben Nova AI'yım ve harika hissediyorum! Sizinle sohbet etmek için buradayım. Ne konuşmak istersiniz?",
|
| 29 |
-
"nova ai nedir": "Nova AI, Teknova tarafından geliştirilen özgün bir yapay zeka modelidir. Türkçe konuşabilir ve çeşitli konularda yardımcı olabilirim.",
|
| 30 |
-
"teknova": "Teknova, Türkiye'nin öncü yapay zeka teknoloji şirketidir. Özgün AI çözümleri geliştiriyoruz.",
|
| 31 |
-
"yapay zeka": "Yapay zeka, bilgisayarların insan benzeri düşünme ve öğrenme yetenekleri göstermesidir. Ben de bir yapay zeka örneğiyim!",
|
| 32 |
-
"projeler": "Size yenilikçi proje fikirleri önerebilirim: AI chatbot, veri analizi, web uygulaması, mobil uygulama gibi...",
|
| 33 |
-
"gelecek": "Gelecekte yapay zeka, otonom araçlar, akıllı şehirler ve personalize eğitim gibi alanlarda devrim yaratacak!"
|
| 34 |
-
}
|
| 35 |
-
return demo_responses
|
| 36 |
-
|
| 37 |
-
def generate_demo_response(message: str) -> str:
|
| 38 |
-
"""
|
| 39 |
-
Demo yanıt oluştur (model olmadığında)
|
| 40 |
-
"""
|
| 41 |
-
message_lower = message.lower().strip()
|
| 42 |
-
demo_responses = load_demo_responses()
|
| 43 |
-
|
| 44 |
-
# Exact match
|
| 45 |
-
if message_lower in demo_responses:
|
| 46 |
-
return demo_responses[message_lower]
|
| 47 |
-
|
| 48 |
-
# Partial match
|
| 49 |
-
for key, response in demo_responses.items():
|
| 50 |
-
if key in message_lower:
|
| 51 |
-
return response
|
| 52 |
-
|
| 53 |
-
# Default responses
|
| 54 |
-
if "?" in message:
|
| 55 |
-
return f"'{message}' hakkında çok ilginç bir soru sordunuz! Nova AI olarak elimden geldiğince yardımcı olmaya çalışırım. Bu konuda daha spesifik sorular sorabilirsiniz."
|
| 56 |
-
|
| 57 |
-
return f"Nova AI burada! '{message}' konusunda konuşmak güzel. Size nasıl yardımcı olabilirim? Daha detaylı sorular sorabilirsiniz."
|
| 58 |
-
|
| 59 |
-
def chat_response(message: str, history: List[List[str]], max_length: int, temperature: float) -> Tuple[str, List[List[str]]]:
|
| 60 |
-
"""
|
| 61 |
-
Chat response function
|
| 62 |
-
"""
|
| 63 |
-
if not message.strip():
|
| 64 |
-
return "", history
|
| 65 |
-
|
| 66 |
-
# Simulate thinking time
|
| 67 |
-
time.sleep(0.5)
|
| 68 |
-
|
| 69 |
-
# Generate response
|
| 70 |
-
if model and tokenizer:
|
| 71 |
-
# Gerçek model ile yanıt (model yüklü ise)
|
| 72 |
-
try:
|
| 73 |
-
response = generate_real_response(message, max_length, temperature)
|
| 74 |
-
except Exception as e:
|
| 75 |
-
response = f"Model hatası: {str(e)} - Demo moduna geçiliyor..."
|
| 76 |
-
response += "\n\n" + generate_demo_response(message)
|
| 77 |
-
else:
|
| 78 |
-
# Demo yanıt
|
| 79 |
-
response = generate_demo_response(message)
|
| 80 |
-
response += "\n\n💡 *Not: Bu demo modunda çalışıyor. Gerçek Nova AI modeli yüklendiğinde daha gelişmiş yanıtlar alacaksınız.*"
|
| 81 |
-
|
| 82 |
-
# Add to history
|
| 83 |
-
history.append([message, response])
|
| 84 |
-
return "", history
|
| 85 |
-
|
| 86 |
-
def generate_real_response(message: str, max_length: int, temperature: float) -> str:
|
| 87 |
-
"""
|
| 88 |
-
Gerçek model ile yanıt oluştur
|
| 89 |
-
"""
|
| 90 |
-
if not model or not tokenizer:
|
| 91 |
-
return generate_demo_response(message)
|
| 92 |
-
|
| 93 |
-
try:
|
| 94 |
-
inputs = tokenizer.encode(message, return_tensors="pt")
|
| 95 |
-
if device == "cuda":
|
| 96 |
-
inputs = inputs.to(device)
|
| 97 |
-
|
| 98 |
-
with torch.no_grad():
|
| 99 |
-
outputs = model.generate(
|
| 100 |
-
inputs,
|
| 101 |
-
max_length=max_length,
|
| 102 |
-
temperature=temperature,
|
| 103 |
-
do_sample=True,
|
| 104 |
-
pad_token_id=tokenizer.eos_token_id,
|
| 105 |
-
no_repeat_ngram_size=3,
|
| 106 |
-
top_p=0.9
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 110 |
-
if message in response:
|
| 111 |
-
response = response.replace(message, "").strip()
|
| 112 |
-
|
| 113 |
-
return response if response else generate_demo_response(message)
|
| 114 |
-
|
| 115 |
-
except Exception as e:
|
| 116 |
-
logger.error(f"Model generation error: {e}")
|
| 117 |
-
return generate_demo_response(message)
|
| 118 |
-
|
| 119 |
-
def load_model():
|
| 120 |
-
"""
|
| 121 |
-
Model yükleme (opsiyonel)
|
| 122 |
-
"""
|
| 123 |
-
global model, tokenizer
|
| 124 |
-
|
| 125 |
-
try:
|
| 126 |
-
# Model path'leri
|
| 127 |
-
possible_paths = [
|
| 128 |
-
"/data/nova-ai-model",
|
| 129 |
-
"./nova-ai-model",
|
| 130 |
-
"/app/nova-ai-model"
|
| 131 |
-
]
|
| 132 |
-
|
| 133 |
-
model_path = None
|
| 134 |
-
for path in possible_paths:
|
| 135 |
-
if os.path.exists(path):
|
| 136 |
-
model_path = path
|
| 137 |
-
logger.info(f"Model found at: {path}")
|
| 138 |
-
break
|
| 139 |
-
|
| 140 |
-
if not model_path:
|
| 141 |
-
logger.warning("No model files found - running in demo mode")
|
| 142 |
-
return "🎭 Demo Mode: Model dosyaları bulunamadı, demo yanıtlar kullanılıyor"
|
| 143 |
-
|
| 144 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 145 |
-
|
| 146 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 147 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 148 |
-
model_path,
|
| 149 |
-
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
| 150 |
-
device_map="auto" if device == "cuda" else None,
|
| 151 |
-
trust_remote_code=True
|
| 152 |
-
)
|
| 153 |
-
|
| 154 |
-
logger.info(f"✅ Nova AI model loaded successfully on {device}")
|
| 155 |
-
return f"✅ Nova AI model hazır! ({device})"
|
| 156 |
-
|
| 157 |
-
except Exception as e:
|
| 158 |
-
logger.error(f"Model loading failed: {e}")
|
| 159 |
-
return f"🎭 Demo Mode: Model yüklenemedi, demo yanıtlar kullanılıyor"
|
| 160 |
-
|
| 161 |
-
def clear_chat():
|
| 162 |
-
"""Clear chat history"""
|
| 163 |
-
return []
|
| 164 |
-
|
| 165 |
-
# Model yükle (başlangıçta)
|
| 166 |
-
initial_status = load_model()
|
| 167 |
-
|
| 168 |
-
# 🎨 Gradio Interface
|
| 169 |
-
def create_interface():
|
| 170 |
-
"""
|
| 171 |
-
Nova AI Gradio interface
|
| 172 |
-
"""
|
| 173 |
-
|
| 174 |
-
with gr.Blocks(
|
| 175 |
-
theme=gr.themes.Soft(),
|
| 176 |
-
title="🚀 Teknova Nova AI",
|
| 177 |
-
css="""
|
| 178 |
-
.main-header {
|
| 179 |
-
text-align: center;
|
| 180 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 181 |
-
color: white;
|
| 182 |
-
padding: 2rem;
|
| 183 |
-
border-radius: 15px;
|
| 184 |
-
margin-bottom: 2rem;
|
| 185 |
-
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
| 186 |
-
}
|
| 187 |
-
.main-header h1 {
|
| 188 |
-
font-size: 2.5rem;
|
| 189 |
-
margin-bottom: 0.5rem;
|
| 190 |
-
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
| 191 |
-
}
|
| 192 |
-
.chat-container {
|
| 193 |
-
border-radius: 10px;
|
| 194 |
-
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
|
| 195 |
-
}
|
| 196 |
-
.control-panel {
|
| 197 |
-
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 198 |
-
padding: 1.5rem;
|
| 199 |
-
border-radius: 10px;
|
| 200 |
-
margin: 1rem 0;
|
| 201 |
-
}
|
| 202 |
-
.example-buttons {
|
| 203 |
-
margin: 1rem 0;
|
| 204 |
-
}
|
| 205 |
-
.footer {
|
| 206 |
-
text-align: center;
|
| 207 |
-
padding: 2rem;
|
| 208 |
-
background: #f8f9fa;
|
| 209 |
-
border-radius: 10px;
|
| 210 |
-
margin-top: 2rem;
|
| 211 |
-
border: 1px solid #e9ecef;
|
| 212 |
-
}
|
| 213 |
-
"""
|
| 214 |
-
) as demo:
|
| 215 |
-
|
| 216 |
-
# Header
|
| 217 |
-
gr.HTML("""
|
| 218 |
-
<div class="main-header">
|
| 219 |
-
<h1>🚀 Teknova Nova AI</h1>
|
| 220 |
-
<p style="font-size: 1.2rem; margin-bottom: 0.5rem;">Özgün Yapay Zeka Teknolojisi</p>
|
| 221 |
-
<p style="font-size: 1rem; opacity: 0.9;"><em>Powered by Teknova - Live on Hugging Face Spaces!</em></p>
|
| 222 |
-
</div>
|
| 223 |
-
""")
|
| 224 |
-
|
| 225 |
-
# Status
|
| 226 |
-
gr.Markdown(f"**🔧 Sistem Durumu:** {initial_status}")
|
| 227 |
-
|
| 228 |
-
# Main interface
|
| 229 |
-
with gr.Row():
|
| 230 |
-
with gr.Column(scale=3):
|
| 231 |
-
chatbot = gr.Chatbot(
|
| 232 |
-
label="💬 Nova AI Sohbet",
|
| 233 |
-
height=450,
|
| 234 |
-
show_label=True,
|
| 235 |
-
container=True,
|
| 236 |
-
elem_classes=["chat-container"],
|
| 237 |
-
avatar_images=("👤", "🤖")
|
| 238 |
-
)
|
| 239 |
-
|
| 240 |
-
with gr.Row():
|
| 241 |
-
msg = gr.Textbox(
|
| 242 |
-
label="✍️ Mesajınız",
|
| 243 |
-
placeholder="Nova AI'ye sorunuzu yazın... (Örn: 'Merhaba', 'Yapay zeka nedir?')",
|
| 244 |
-
lines=2,
|
| 245 |
-
scale=4,
|
| 246 |
-
show_label=False
|
| 247 |
-
)
|
| 248 |
-
send_btn = gr.Button("📤 Gönder", scale=1, variant="primary", size="lg")
|
| 249 |
-
|
| 250 |
-
clear_btn = gr.Button("🗑️ Sohbeti Temizle", variant="secondary", size="sm")
|
| 251 |
-
|
| 252 |
-
with gr.Column(scale=1):
|
| 253 |
-
with gr.Group():
|
| 254 |
-
gr.Markdown("### ⚙️ Ayarlar")
|
| 255 |
-
|
| 256 |
-
max_length = gr.Slider(
|
| 257 |
-
minimum=50,
|
| 258 |
-
maximum=500,
|
| 259 |
-
value=200,
|
| 260 |
-
step=25,
|
| 261 |
-
label="📏 Maksimum Uzunluk",
|
| 262 |
-
info="Yanıtın ne kadar uzun olacağını belirler"
|
| 263 |
-
)
|
| 264 |
-
|
| 265 |
-
temperature = gr.Slider(
|
| 266 |
-
minimum=0.1,
|
| 267 |
-
maximum=1.2,
|
| 268 |
-
value=0.7,
|
| 269 |
-
step=0.1,
|
| 270 |
-
label="🎨 Yaratıcılık (Temperature)",
|
| 271 |
-
info="Düşük: tutarlı, Yüksek: yaratıcı"
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
with gr.Group():
|
| 275 |
-
gr.Markdown("### 💡 Bilgi")
|
| 276 |
-
gr.Markdown("""
|
| 277 |
-
**Nova AI Özellikleri:**
|
| 278 |
-
- 🧠 Gelişmiş dil anlama
|
| 279 |
-
- 💬 Doğal konuşma
|
| 280 |
-
- 🌍 Türkçe optimizasyonu
|
| 281 |
-
- ⚡ Hızlı yanıt
|
| 282 |
-
""")
|
| 283 |
-
|
| 284 |
-
# Example questions
|
| 285 |
-
gr.Markdown("### 💬 Örnek Sorular")
|
| 286 |
-
with gr.Row(elem_classes=["example-buttons"]):
|
| 287 |
-
example_buttons = [
|
| 288 |
-
gr.Button("👋 Merhaba Nova AI!", size="sm", variant="secondary"),
|
| 289 |
-
gr.Button("🤖 Yapay zeka nedir?", size="sm", variant="secondary"),
|
| 290 |
-
gr.Button("🚀 Teknova hakkında bilgi", size="sm", variant="secondary"),
|
| 291 |
-
gr.Button("💡 Proje fikirleri öner", size="sm", variant="secondary")
|
| 292 |
-
]
|
| 293 |
-
|
| 294 |
-
# Event handlers
|
| 295 |
-
send_btn.click(
|
| 296 |
-
chat_response,
|
| 297 |
-
inputs=[msg, chatbot, max_length, temperature],
|
| 298 |
-
outputs=[msg, chatbot],
|
| 299 |
-
show_progress=True
|
| 300 |
-
)
|
| 301 |
-
|
| 302 |
-
msg.submit(
|
| 303 |
-
chat_response,
|
| 304 |
-
inputs=[msg, chatbot, max_length, temperature],
|
| 305 |
-
outputs=[msg, chatbot],
|
| 306 |
-
show_progress=True
|
| 307 |
-
)
|
| 308 |
-
|
| 309 |
-
clear_btn.click(clear_chat, outputs=chatbot)
|
| 310 |
-
|
| 311 |
-
# Example button handlers
|
| 312 |
-
example_buttons[0].click(lambda: "Merhaba Nova AI!", outputs=msg)
|
| 313 |
-
example_buttons[1].click(lambda: "Yapay zeka nedir?", outputs=msg)
|
| 314 |
-
example_buttons[2].click(lambda: "Teknova hakkında bilgi ver", outputs=msg)
|
| 315 |
-
example_buttons[3].click(lambda: "Bana yenilikçi proje fikirleri öner", outputs=msg)
|
| 316 |
-
|
| 317 |
-
# Footer
|
| 318 |
-
gr.HTML("""
|
| 319 |
-
<div class="footer">
|
| 320 |
-
<h3>🚀 Teknova Nova AI</h3>
|
| 321 |
-
<p><strong>Özgün yapay zeka teknolojisi</strong></p>
|
| 322 |
-
<p>
|
| 323 |
-
<a href="https://github.com/veteroner/novaai" target="_blank" style="margin: 0 10px;">📂 GitHub</a> |
|
| 324 |
-
<a href="https://huggingface.co/spaces/veteroner/NovaAI" target="_blank" style="margin: 0 10px;">🤗 HF Spaces</a> |
|
| 325 |
-
<a href="mailto:teknova@example.com" style="margin: 0 10px;">📧 İletişim</a>
|
| 326 |
-
</p>
|
| 327 |
-
<p style="margin-top: 1rem; font-size: 0.9rem; color: #666;">
|
| 328 |
-
<em>Made with ❤️ by Teknova | Powered by Hugging Face Spaces</em>
|
| 329 |
-
</p>
|
| 330 |
-
</div>
|
| 331 |
-
""")
|
| 332 |
-
|
| 333 |
-
return demo
|
| 334 |
-
|
| 335 |
-
# Create and launch
|
| 336 |
-
if __name__ == "__main__":
|
| 337 |
-
demo = create_interface()
|
| 338 |
-
demo.queue(max_size=20, default_concurrency_limit=5)
|
| 339 |
-
demo.launch(
|
| 340 |
-
server_name="0.0.0.0",
|
| 341 |
-
server_port=7860,
|
| 342 |
-
share=False,
|
| 343 |
-
show_error=True,
|
| 344 |
-
debug=False
|
| 345 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HF_Space_Files/requirements.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
gradio==4.11.0
|
| 2 |
-
torch>=1.13.0
|
| 3 |
-
transformers>=4.25.0
|
| 4 |
-
accelerate>=0.20.0
|
| 5 |
-
sentencepiece>=0.1.97
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nova_AI_Chat.ipynb
DELETED
|
@@ -1,268 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": null,
|
| 6 |
-
"metadata": {
|
| 7 |
-
"vscode": {
|
| 8 |
-
"languageId": "plaintext"
|
| 9 |
-
}
|
| 10 |
-
},
|
| 11 |
-
"outputs": [],
|
| 12 |
-
"source": [
|
| 13 |
-
"\"\"\"\n",
|
| 14 |
-
"🚀 Nova AI Chat - Google Colab\n",
|
| 15 |
-
"\n",
|
| 16 |
-
"Teknova'nın Nova AI'sını Google Colab'da ücretsiz GPU ile çalıştırın!\n",
|
| 17 |
-
"\n",
|
| 18 |
-
"📋 Adımlar:\n",
|
| 19 |
-
"1. GPU'yu etkinleştirin (Runtime > Change runtime type > GPU) \n",
|
| 20 |
-
"2. Tüm hücreleri sırayla çalıştırın\n",
|
| 21 |
-
"3. Son hücredeki bağlantıyı açıp Nova AI ile sohbet edin!\n",
|
| 22 |
-
"\"\"\"\n",
|
| 23 |
-
"\n",
|
| 24 |
-
"print(\"🚀 Nova AI Chat - Google Colab Başlıyor!\")\n"
|
| 25 |
-
]
|
| 26 |
-
},
|
| 27 |
-
{
|
| 28 |
-
"cell_type": "code",
|
| 29 |
-
"execution_count": null,
|
| 30 |
-
"metadata": {},
|
| 31 |
-
"outputs": [],
|
| 32 |
-
"source": [
|
| 33 |
-
"# 📦 Gerekli paketleri yükle\n",
|
| 34 |
-
"print(\"🚀 Paketler yükleniyor...\")\n",
|
| 35 |
-
"!pip install -q transformers accelerate bitsandbytes gradio torch\n",
|
| 36 |
-
"print(\"✅ Paketler yüklendi!\")\n"
|
| 37 |
-
]
|
| 38 |
-
},
|
| 39 |
-
{
|
| 40 |
-
"cell_type": "code",
|
| 41 |
-
"execution_count": null,
|
| 42 |
-
"metadata": {},
|
| 43 |
-
"outputs": [],
|
| 44 |
-
"source": [
|
| 45 |
-
"# 📚 Kütüphaneleri içe aktar\n",
|
| 46 |
-
"import gradio as gr\n",
|
| 47 |
-
"import torch\n",
|
| 48 |
-
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
|
| 49 |
-
"import warnings\n",
|
| 50 |
-
"warnings.filterwarnings(\"ignore\")\n",
|
| 51 |
-
"\n",
|
| 52 |
-
"print(f\"🔥 GPU kullanılabilir: {torch.cuda.is_available()}\")\n",
|
| 53 |
-
"if torch.cuda.is_available():\n",
|
| 54 |
-
" print(f\"📱 GPU: {torch.cuda.get_device_name(0)}\")\n"
|
| 55 |
-
]
|
| 56 |
-
},
|
| 57 |
-
{
|
| 58 |
-
"cell_type": "code",
|
| 59 |
-
"execution_count": null,
|
| 60 |
-
"metadata": {},
|
| 61 |
-
"outputs": [],
|
| 62 |
-
"source": [
|
| 63 |
-
"# 🚀 Nova AI modelini yükle\n",
|
| 64 |
-
"MODEL_NAME = \"mistralai/Mistral-7B-Instruct-v0.1\"\n",
|
| 65 |
-
"\n",
|
| 66 |
-
"print(\"🚀 Nova AI modeli yükleniyor... (2-3 dakika sürebilir)\")\n",
|
| 67 |
-
"print(\"💡 Teknova tarafından optimize edilmiş\")\n",
|
| 68 |
-
"\n",
|
| 69 |
-
"# Tokenizer yükle\n",
|
| 70 |
-
"tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)\n",
|
| 71 |
-
"print(\"✅ Nova AI Tokenizer yüklendi\")\n",
|
| 72 |
-
"\n",
|
| 73 |
-
"# Model yükle - 8-bit quantization ile hafıza tasarrufu\n",
|
| 74 |
-
"model = AutoModelForCausalLM.from_pretrained(\n",
|
| 75 |
-
" MODEL_NAME,\n",
|
| 76 |
-
" torch_dtype=torch.float16,\n",
|
| 77 |
-
" device_map=\"auto\",\n",
|
| 78 |
-
" load_in_8bit=True\n",
|
| 79 |
-
")\n",
|
| 80 |
-
"\n",
|
| 81 |
-
"print(\"🎉 Nova AI hazır! Artık sohbet edebilirsiniz.\")\n",
|
| 82 |
-
"print(\"🚀 Teknova ile güçlendirilmiştir\")\n"
|
| 83 |
-
]
|
| 84 |
-
},
|
| 85 |
-
{
|
| 86 |
-
"cell_type": "code",
|
| 87 |
-
"execution_count": null,
|
| 88 |
-
"metadata": {},
|
| 89 |
-
"outputs": [],
|
| 90 |
-
"source": [
|
| 91 |
-
"# 💬 Nova AI Chat fonksiyonu\n",
|
| 92 |
-
"def chat_response(message, history):\n",
|
| 93 |
-
" \"\"\"Nova AI ile sohbet et\"\"\"\n",
|
| 94 |
-
" if not message.strip():\n",
|
| 95 |
-
" return \"❓ Lütfen Nova AI'ya bir mesaj yazın.\"\n",
|
| 96 |
-
" \n",
|
| 97 |
-
" try:\n",
|
| 98 |
-
" # Sohbet geçmişini formatla\n",
|
| 99 |
-
" conversation = \"\"\n",
|
| 100 |
-
" for user_msg, bot_msg in history:\n",
|
| 101 |
-
" conversation += f\"[INST] {user_msg} [/INST] {bot_msg} \"\n",
|
| 102 |
-
" \n",
|
| 103 |
-
" # Yeni mesajı ekle\n",
|
| 104 |
-
" conversation += f\"[INST] {message} [/INST]\"\n",
|
| 105 |
-
" \n",
|
| 106 |
-
" # Tokenize et\n",
|
| 107 |
-
" inputs = tokenizer(\n",
|
| 108 |
-
" conversation, \n",
|
| 109 |
-
" return_tensors=\"pt\", \n",
|
| 110 |
-
" truncation=True, \n",
|
| 111 |
-
" max_length=2048\n",
|
| 112 |
-
" ).to(model.device)\n",
|
| 113 |
-
" \n",
|
| 114 |
-
" # Yanıt üret\n",
|
| 115 |
-
" with torch.no_grad():\n",
|
| 116 |
-
" outputs = model.generate(\n",
|
| 117 |
-
" **inputs,\n",
|
| 118 |
-
" max_new_tokens=512,\n",
|
| 119 |
-
" temperature=0.7,\n",
|
| 120 |
-
" top_p=0.9,\n",
|
| 121 |
-
" do_sample=True,\n",
|
| 122 |
-
" pad_token_id=tokenizer.eos_token_id,\n",
|
| 123 |
-
" eos_token_id=tokenizer.eos_token_id\n",
|
| 124 |
-
" )\n",
|
| 125 |
-
" \n",
|
| 126 |
-
" # Yanıtı decode et\n",
|
| 127 |
-
" response = tokenizer.decode(outputs[0], skip_special_tokens=True)\n",
|
| 128 |
-
" \n",
|
| 129 |
-
" # Sadece yeni üretilen kısmı al\n",
|
| 130 |
-
" new_response = response[len(conversation):].strip()\n",
|
| 131 |
-
" \n",
|
| 132 |
-
" return new_response\n",
|
| 133 |
-
" \n",
|
| 134 |
-
" except Exception as e:\n",
|
| 135 |
-
" return f\"❌ Hata: {str(e)}\"\n",
|
| 136 |
-
"\n",
|
| 137 |
-
"print(\"✅ Nova AI Chat fonksiyonu hazır!\")\n"
|
| 138 |
-
]
|
| 139 |
-
},
|
| 140 |
-
{
|
| 141 |
-
"cell_type": "code",
|
| 142 |
-
"execution_count": null,
|
| 143 |
-
"metadata": {},
|
| 144 |
-
"outputs": [],
|
| 145 |
-
"source": [
|
| 146 |
-
"# 🎨 Nova AI Gradio arayüzü oluştur\n",
|
| 147 |
-
"with gr.Blocks(\n",
|
| 148 |
-
" theme=gr.themes.Soft(),\n",
|
| 149 |
-
" title=\"Nova AI Chat - Teknova\"\n",
|
| 150 |
-
") as demo:\n",
|
| 151 |
-
" \n",
|
| 152 |
-
" gr.HTML(\"\"\"\n",
|
| 153 |
-
" <div style=\"text-align: center; padding: 20px; background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%); color: white; border-radius: 10px; margin-bottom: 20px;\">\n",
|
| 154 |
-
" <h1>🚀 Nova AI Chat</h1>\n",
|
| 155 |
-
" <p>Google Colab'da çalışan <strong>Teknova</strong> AI asistanınız</p>\n",
|
| 156 |
-
" <small>⚡ GPU hızlandırmalı • 🧠 Gelişmiş AI • 🚀 Teknova</small>\n",
|
| 157 |
-
" </div>\n",
|
| 158 |
-
" \"\"\")\n",
|
| 159 |
-
" \n",
|
| 160 |
-
" chatbot = gr.Chatbot(\n",
|
| 161 |
-
" height=400,\n",
|
| 162 |
-
" show_label=False,\n",
|
| 163 |
-
" show_share_button=True,\n",
|
| 164 |
-
" show_copy_button=True\n",
|
| 165 |
-
" )\n",
|
| 166 |
-
" \n",
|
| 167 |
-
" with gr.Row():\n",
|
| 168 |
-
" msg = gr.Textbox(\n",
|
| 169 |
-
" placeholder=\"Nova AI'ya mesajınızı yazın... (Türkçe sorular sorabilirsiniz)\",\n",
|
| 170 |
-
" show_label=False,\n",
|
| 171 |
-
" scale=4\n",
|
| 172 |
-
" )\n",
|
| 173 |
-
" submit = gr.Button(\"🚀 Gönder\", scale=1, variant=\"primary\")\n",
|
| 174 |
-
" \n",
|
| 175 |
-
" with gr.Row():\n",
|
| 176 |
-
" clear = gr.Button(\"🗑️ Temizle\", scale=1)\n",
|
| 177 |
-
" \n",
|
| 178 |
-
" gr.HTML(\"\"\"\n",
|
| 179 |
-
" <div style=\"text-align: center; padding: 15px; background: #f0f0f0; border-radius: 8px; margin-top: 10px;\">\n",
|
| 180 |
-
" <h3>💡 Nova AI'ya sorabilecekleriniz:</h3>\n",
|
| 181 |
-
" <p>• \"Python'da liste comprehension nasıl kullanılır?\"</p>\n",
|
| 182 |
-
" <p>• \"Türkiye'nin başkenti neresidir?\"</p>\n",
|
| 183 |
-
" <p>• \"Bana bir hikaye anlat\"</p>\n",
|
| 184 |
-
" <p>• \"Yapay zeka nedir?\"</p>\n",
|
| 185 |
-
" </div>\n",
|
| 186 |
-
" \"\"\")\n",
|
| 187 |
-
" \n",
|
| 188 |
-
" # Event handlers\n",
|
| 189 |
-
" def user_message(message, history):\n",
|
| 190 |
-
" return \"\", history + [[message, None]]\n",
|
| 191 |
-
" \n",
|
| 192 |
-
" def bot_message(history):\n",
|
| 193 |
-
" user_message = history[-1][0]\n",
|
| 194 |
-
" bot_response = chat_response(user_message, history[:-1])\n",
|
| 195 |
-
" history[-1][1] = bot_response\n",
|
| 196 |
-
" return history\n",
|
| 197 |
-
" \n",
|
| 198 |
-
" msg.submit(user_message, [msg, chatbot], [msg, chatbot], queue=False).then(\n",
|
| 199 |
-
" bot_message, chatbot, chatbot\n",
|
| 200 |
-
" )\n",
|
| 201 |
-
" submit.click(user_message, [msg, chatbot], [msg, chatbot], queue=False).then(\n",
|
| 202 |
-
" bot_message, chatbot, chatbot\n",
|
| 203 |
-
" )\n",
|
| 204 |
-
" clear.click(lambda: None, None, chatbot, queue=False)\n",
|
| 205 |
-
"\n",
|
| 206 |
-
"print(\"🎨 Nova AI arayüzü hazır!\")\n"
|
| 207 |
-
]
|
| 208 |
-
},
|
| 209 |
-
{
|
| 210 |
-
"cell_type": "code",
|
| 211 |
-
"execution_count": null,
|
| 212 |
-
"metadata": {},
|
| 213 |
-
"outputs": [],
|
| 214 |
-
"source": [
|
| 215 |
-
"# 🚀 Nova AI Uygulamasını başlat\n",
|
| 216 |
-
"print(\"🌟 Nova AI Chat uygulaması başlatılıyor...\")\n",
|
| 217 |
-
"print(\"📱 Aşağıdaki bağlantıyı açıp sohbet etmeye başlayın!\")\n",
|
| 218 |
-
"\n",
|
| 219 |
-
"demo.launch(\n",
|
| 220 |
-
" share=True, # Herkesle paylaşılabilir link\n",
|
| 221 |
-
" debug=True,\n",
|
| 222 |
-
" show_error=True\n",
|
| 223 |
-
")\n"
|
| 224 |
-
]
|
| 225 |
-
},
|
| 226 |
-
{
|
| 227 |
-
"cell_type": "code",
|
| 228 |
-
"execution_count": null,
|
| 229 |
-
"metadata": {},
|
| 230 |
-
"outputs": [],
|
| 231 |
-
"source": [
|
| 232 |
-
"\"\"\"\n",
|
| 233 |
-
"🎉 Tebrikler!\n",
|
| 234 |
-
"\n",
|
| 235 |
-
"Nova AI Chat artık çalışıyor! \n",
|
| 236 |
-
"\n",
|
| 237 |
-
"📋 Kullanım İpuçları:\n",
|
| 238 |
-
"- 🇹🇷 Türkçe sorular sorun\n",
|
| 239 |
-
"- 💬 Uzun sohbetler yapabilirsiniz \n",
|
| 240 |
-
"- 🔄 \"Temizle\" ile geçmişi silin\n",
|
| 241 |
-
"- ⚡ GPU sayesinde hızlı yanıtlar\n",
|
| 242 |
-
"- 🚀 Nova AI teknolojisini deneyimleyin\n",
|
| 243 |
-
"\n",
|
| 244 |
-
"🔗 Paylaşım:\n",
|
| 245 |
-
"- Yukarıdaki public link'i paylaşabilirsiniz\n",
|
| 246 |
-
"- Link 72 saat aktif kalır\n",
|
| 247 |
-
"- Colab kapatılırsa link devre dışı kalır\n",
|
| 248 |
-
"\n",
|
| 249 |
-
"🌟 Nova AI Özellikleri:\n",
|
| 250 |
-
"- Teknova kalitesi garantisi\n",
|
| 251 |
-
"- Gelişmiş AI teknolojisi\n",
|
| 252 |
-
"- Hızlı ve güvenilir yanıtlar\n",
|
| 253 |
-
"\n",
|
| 254 |
-
"🚀 Teknova Nova AI ile güçlendirilmiştir\n",
|
| 255 |
-
"\"\"\"\n",
|
| 256 |
-
"\n",
|
| 257 |
-
"print(\"📘 Nova AI Chat kullanım rehberi yukarıda!\")\n"
|
| 258 |
-
]
|
| 259 |
-
}
|
| 260 |
-
],
|
| 261 |
-
"metadata": {
|
| 262 |
-
"language_info": {
|
| 263 |
-
"name": "python"
|
| 264 |
-
}
|
| 265 |
-
},
|
| 266 |
-
"nbformat": 4,
|
| 267 |
-
"nbformat_minor": 2
|
| 268 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nova_AI_Colab.py
DELETED
|
@@ -1,211 +0,0 @@
|
|
| 1 |
-
# 🚀 Teknova Nova AI - Google Colab Özel Scripti
|
| 2 |
-
# 🌟 Tamamen özgün Teknova Nova AI modeli
|
| 3 |
-
# 💡 Colab'da kendi modelinizi çalıştırın
|
| 4 |
-
|
| 5 |
-
import gradio as gr
|
| 6 |
-
import torch
|
| 7 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 8 |
-
import os
|
| 9 |
-
import zipfile
|
| 10 |
-
from google.colab import files
|
| 11 |
-
|
| 12 |
-
print("🚀 Teknova Nova AI - Google Colab Edition")
|
| 13 |
-
print("🌟 Tamamen özgün yapay zeka teknolojisi")
|
| 14 |
-
print("=" * 60)
|
| 15 |
-
|
| 16 |
-
# Colab için Nova AI model yolu
|
| 17 |
-
MODEL_PATH = "/content/nova-ai-model"
|
| 18 |
-
|
| 19 |
-
def upload_and_extract_model():
|
| 20 |
-
"""Nova AI modelini Colab'a yükle ve çıkart"""
|
| 21 |
-
print("📂 Nova AI model dosyalarınızı yükleyin...")
|
| 22 |
-
print("💡 ZIP dosyası olarak yüklemeniz önerilir")
|
| 23 |
-
|
| 24 |
-
# Dosya yükleme
|
| 25 |
-
uploaded = files.upload()
|
| 26 |
-
|
| 27 |
-
for filename in uploaded.keys():
|
| 28 |
-
print(f"📦 İşleniyor: {filename}")
|
| 29 |
-
|
| 30 |
-
if filename.endswith('.zip'):
|
| 31 |
-
# ZIP dosyasını çıkart
|
| 32 |
-
with zipfile.ZipFile(filename, 'r') as zip_ref:
|
| 33 |
-
zip_ref.extractall(MODEL_PATH)
|
| 34 |
-
print(f"✅ {filename} başarıyla çıkartıldı")
|
| 35 |
-
os.remove(filename) # ZIP dosyasını sil
|
| 36 |
-
else:
|
| 37 |
-
# Tek dosyayı model klasörüne taşı
|
| 38 |
-
os.makedirs(MODEL_PATH, exist_ok=True)
|
| 39 |
-
os.rename(filename, os.path.join(MODEL_PATH, filename))
|
| 40 |
-
print(f"✅ {filename} model klasörüne taşındı")
|
| 41 |
-
|
| 42 |
-
print("🎉 Nova AI model dosyaları hazır!")
|
| 43 |
-
|
| 44 |
-
def load_nova_ai():
|
| 45 |
-
"""Nova AI modelini yükle"""
|
| 46 |
-
print("🚀 Teknova Nova AI modeli yükleniyor...")
|
| 47 |
-
|
| 48 |
-
if not os.path.exists(MODEL_PATH):
|
| 49 |
-
print("❌ Nova AI model klasörü bulunamadı!")
|
| 50 |
-
print("📤 Önce modelinizi yükleyin...")
|
| 51 |
-
upload_and_extract_model()
|
| 52 |
-
|
| 53 |
-
try:
|
| 54 |
-
# Nova AI Tokenizer
|
| 55 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 56 |
-
MODEL_PATH,
|
| 57 |
-
trust_remote_code=True
|
| 58 |
-
)
|
| 59 |
-
print("✅ Nova AI Tokenizer yüklendi")
|
| 60 |
-
|
| 61 |
-
# Nova AI Model - Colab GPU optimizasyonu
|
| 62 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
-
MODEL_PATH,
|
| 64 |
-
torch_dtype=torch.float16,
|
| 65 |
-
device_map="auto",
|
| 66 |
-
trust_remote_code=True,
|
| 67 |
-
load_in_8bit=True # Colab T4 için optimize
|
| 68 |
-
)
|
| 69 |
-
print("✅ Nova AI Model yüklendi")
|
| 70 |
-
print("🎉 Teknova Nova AI hazır!")
|
| 71 |
-
|
| 72 |
-
return model, tokenizer
|
| 73 |
-
|
| 74 |
-
except Exception as e:
|
| 75 |
-
print(f"❌ Nova AI yükleme hatası: {e}")
|
| 76 |
-
return None, None
|
| 77 |
-
|
| 78 |
-
def nova_chat(message, history, model, tokenizer):
|
| 79 |
-
"""Nova AI ile sohbet"""
|
| 80 |
-
if model is None or tokenizer is None:
|
| 81 |
-
return "❌ Nova AI modeli yüklenmedi. Lütfen modeli yükleyin."
|
| 82 |
-
|
| 83 |
-
try:
|
| 84 |
-
# Nova AI konuşma formatı
|
| 85 |
-
conversation = ""
|
| 86 |
-
for user_msg, bot_msg in history:
|
| 87 |
-
conversation += f"Kullanıcı: {user_msg}\nNova AI: {bot_msg}\n"
|
| 88 |
-
|
| 89 |
-
conversation += f"Kullanıcı: {message}\nNova AI:"
|
| 90 |
-
|
| 91 |
-
# Nova AI yanıt üret
|
| 92 |
-
inputs = tokenizer(
|
| 93 |
-
conversation,
|
| 94 |
-
return_tensors="pt",
|
| 95 |
-
truncation=True,
|
| 96 |
-
max_length=2048
|
| 97 |
-
).to(model.device)
|
| 98 |
-
|
| 99 |
-
with torch.no_grad():
|
| 100 |
-
outputs = model.generate(
|
| 101 |
-
**inputs,
|
| 102 |
-
max_new_tokens=512,
|
| 103 |
-
temperature=0.7,
|
| 104 |
-
top_p=0.9,
|
| 105 |
-
do_sample=True,
|
| 106 |
-
pad_token_id=tokenizer.eos_token_id
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 110 |
-
nova_response = response[len(conversation):].strip()
|
| 111 |
-
|
| 112 |
-
return nova_response
|
| 113 |
-
|
| 114 |
-
except Exception as e:
|
| 115 |
-
return f"❌ Nova AI hatası: {str(e)}"
|
| 116 |
-
|
| 117 |
-
def create_nova_interface():
|
| 118 |
-
"""Nova AI Gradio arayüzü oluştur"""
|
| 119 |
-
|
| 120 |
-
# Nova AI modelini yükle
|
| 121 |
-
model, tokenizer = load_nova_ai()
|
| 122 |
-
|
| 123 |
-
# Gradio arayüzü
|
| 124 |
-
with gr.Blocks(
|
| 125 |
-
theme=gr.themes.Soft(),
|
| 126 |
-
title="Teknova Nova AI - Colab Edition"
|
| 127 |
-
) as demo:
|
| 128 |
-
|
| 129 |
-
gr.HTML("""
|
| 130 |
-
<div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #ff6b6b, #4ecdc4); border-radius: 15px; margin-bottom: 20px;">
|
| 131 |
-
<h1 style="color: white; font-size: 2.5rem; margin: 0;">
|
| 132 |
-
🚀 Teknova Nova AI
|
| 133 |
-
</h1>
|
| 134 |
-
<p style="color: white; font-size: 1.2rem; margin: 10px 0;">
|
| 135 |
-
<strong>Google Colab Edition</strong> - Özgün Yapay Zeka
|
| 136 |
-
</p>
|
| 137 |
-
<div style="background: rgba(255,255,255,0.3); padding: 10px; border-radius: 10px; display: inline-block;">
|
| 138 |
-
🌟 Tamamen özgün model • ⚡ Token gerektirmez • 🧠 Colab GPU optimized
|
| 139 |
-
</div>
|
| 140 |
-
</div>
|
| 141 |
-
""")
|
| 142 |
-
|
| 143 |
-
chatbot = gr.Chatbot(
|
| 144 |
-
height=500,
|
| 145 |
-
show_label=False,
|
| 146 |
-
show_copy_button=True,
|
| 147 |
-
avatar_images=[None, "🤖"]
|
| 148 |
-
)
|
| 149 |
-
|
| 150 |
-
with gr.Row():
|
| 151 |
-
msg = gr.Textbox(
|
| 152 |
-
placeholder="Nova AI'ya mesajınızı yazın...",
|
| 153 |
-
show_label=False,
|
| 154 |
-
scale=4
|
| 155 |
-
)
|
| 156 |
-
send = gr.Button("🚀 Gönder", scale=1, variant="primary")
|
| 157 |
-
|
| 158 |
-
with gr.Row():
|
| 159 |
-
clear = gr.Button("🗑️ Temizle")
|
| 160 |
-
reload = gr.Button("🔄 Model Yenile")
|
| 161 |
-
|
| 162 |
-
gr.HTML("""
|
| 163 |
-
<div style="text-align: center; padding: 15px; background: #f8f9fa; border-radius: 10px; margin-top: 15px;">
|
| 164 |
-
<h3>💡 Nova AI Colab Rehberi</h3>
|
| 165 |
-
<p>🔸 Kendi Nova AI modelinizi ZIP olarak yükleyin</p>
|
| 166 |
-
<p>🔸 Model otomatik olarak /content/nova-ai-model klasörüne çıkartılır</p>
|
| 167 |
-
<p>🔸 T4 GPU ile optimize edilmiş performans</p>
|
| 168 |
-
<p style="color: #ff6b6b; font-weight: bold;">🚀 Teknova Nova AI - Tamamen Özgün</p>
|
| 169 |
-
</div>
|
| 170 |
-
""")
|
| 171 |
-
|
| 172 |
-
# Event handlers
|
| 173 |
-
def user_message(message, history):
|
| 174 |
-
return "", history + [[message, None]]
|
| 175 |
-
|
| 176 |
-
def bot_message(history):
|
| 177 |
-
user_message = history[-1][0]
|
| 178 |
-
bot_response = nova_chat(user_message, history[:-1], model, tokenizer)
|
| 179 |
-
history[-1][1] = bot_response
|
| 180 |
-
return history
|
| 181 |
-
|
| 182 |
-
def reload_model():
|
| 183 |
-
nonlocal model, tokenizer
|
| 184 |
-
model, tokenizer = load_nova_ai()
|
| 185 |
-
return "🔄 Nova AI modeli yeniden yüklendi!"
|
| 186 |
-
|
| 187 |
-
msg.submit(user_message, [msg, chatbot], [msg, chatbot], queue=False).then(
|
| 188 |
-
bot_message, chatbot, chatbot
|
| 189 |
-
)
|
| 190 |
-
send.click(user_message, [msg, chatbot], [msg, chatbot], queue=False).then(
|
| 191 |
-
bot_message, chatbot, chatbot
|
| 192 |
-
)
|
| 193 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
| 194 |
-
reload.click(reload_model, None, None)
|
| 195 |
-
|
| 196 |
-
return demo
|
| 197 |
-
|
| 198 |
-
# Ana fonksiyon
|
| 199 |
-
if __name__ == "__main__":
|
| 200 |
-
print("🎨 Nova AI Colab arayüzü oluşturuluyor...")
|
| 201 |
-
|
| 202 |
-
demo = create_nova_interface()
|
| 203 |
-
|
| 204 |
-
print("🌟 Nova AI Colab başlatılıyor...")
|
| 205 |
-
demo.launch(
|
| 206 |
-
share=True, # Public link oluştur
|
| 207 |
-
debug=True,
|
| 208 |
-
show_error=True,
|
| 209 |
-
server_name="0.0.0.0",
|
| 210 |
-
server_port=7860
|
| 211 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: red
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.44.1
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
language:
|
|
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.44.1
|
| 8 |
+
app_file: gradio_app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
language:
|
README_HF.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Nova AI
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.11.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# 🚀 Teknova Nova AI
|
| 14 |
-
|
| 15 |
-
**Özgün yapay zeka teknolojisi - Hugging Face Spaces'te canlı!**
|
| 16 |
-
|
| 17 |
-
## 🌟 Özellikler
|
| 18 |
-
|
| 19 |
-
- 🧠 **Gelişmiş Dil Modeli** - Teknova'nın özgün AI teknolojisi
|
| 20 |
-
- 💬 **Doğal Konuşma** - İnsan benzeri etkileşim
|
| 21 |
-
- 🌍 **Türkçe Optimizasyonu** - Ana dil Türkçe
|
| 22 |
-
- ⚡ **Hızlı Yanıt** - Optimize edilmiş performans
|
| 23 |
-
- 🎛️ **Ayarlanabilir Parametreler** - Temperature ve uzunluk kontrolü
|
| 24 |
-
|
| 25 |
-
## 🚀 Kullanım
|
| 26 |
-
|
| 27 |
-
1. **Mesajınızı yazın** - Text kutusuna sorunuzu girin
|
| 28 |
-
2. **Gönder** - Butona basın veya Enter'a basın
|
| 29 |
-
3. **Yanıt alın** - Nova AI'den hızlı yanıt
|
| 30 |
-
|
| 31 |
-
### 💡 Örnek Sorular
|
| 32 |
-
|
| 33 |
-
- "Merhaba Nova AI!"
|
| 34 |
-
- "Yapay zeka nedir?"
|
| 35 |
-
- "Teknova hakkında bilgi ver"
|
| 36 |
-
- "Bana proje fikirleri öner"
|
| 37 |
-
|
| 38 |
-
## ⚙️ Ayarlar
|
| 39 |
-
|
| 40 |
-
- **Maksimum Uzunluk**: Yanıtın uzunluğunu kontrol eder
|
| 41 |
-
- **Temperature**: Yaratıcılık seviyesi (0.1 = tutarlı, 1.2 = yaratıcı)
|
| 42 |
-
|
| 43 |
-
## 🔗 Linkler
|
| 44 |
-
|
| 45 |
-
- **GitHub**: [veteroner/novaai](https://github.com/veteroner/novaai)
|
| 46 |
-
- **Website**: [teknova.com](https://teknova.com)
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
**Made with ❤️ by Teknova**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basit_konsol.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
🚀 Nova AI - Basit Konsol Uygulaması
|
| 3 |
+
Teknova tarafından geliştirilen özgün yapay zeka modeli
|
| 4 |
+
Hub ve local model desteği
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 8 |
+
import torch
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
# Model seçenekleri
|
| 12 |
+
MODELS = {
|
| 13 |
+
"1": {"name": "Nova AI Hub", "path": "veteroner/NovaAI"},
|
| 14 |
+
"2": {"name": "Local Model", "path": "./nova-ai-model"}
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
def select_model():
|
| 18 |
+
"""Kullanıcıdan model seçimi al"""
|
| 19 |
+
print("\n📋 Model Seçimi:")
|
| 20 |
+
for key, value in MODELS.items():
|
| 21 |
+
if value["path"].startswith("./"):
|
| 22 |
+
status = "✅" if os.path.exists(value["path"]) else "❌"
|
| 23 |
+
else:
|
| 24 |
+
status = "🌐" # Hub modeli
|
| 25 |
+
print(f"{key}. {value['name']} {status}")
|
| 26 |
+
|
| 27 |
+
while True:
|
| 28 |
+
choice = input("\nModel seçin (1 veya 2): ").strip()
|
| 29 |
+
if choice in MODELS:
|
| 30 |
+
return MODELS[choice]["path"], MODELS[choice]["name"]
|
| 31 |
+
print("❌ Geçersiz seçim! 1 veya 2 yazın.")
|
| 32 |
+
|
| 33 |
+
def load_model(model_path, model_name):
|
| 34 |
+
"""Seçilen modeli yükle"""
|
| 35 |
+
print(f"\n🚀 {model_name} yükleniyor...")
|
| 36 |
+
|
| 37 |
+
# Local model kontrolü
|
| 38 |
+
if model_path.startswith("./") and not os.path.exists(model_path):
|
| 39 |
+
print(f"❌ Local model bulunamadı: {model_path}")
|
| 40 |
+
return None, None
|
| 41 |
+
|
| 42 |
+
try:
|
| 43 |
+
# Tokenizer yükle
|
| 44 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 45 |
+
model_path,
|
| 46 |
+
trust_remote_code=True
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
# Model yükleme ayarları
|
| 50 |
+
load_kwargs = {
|
| 51 |
+
"torch_dtype": torch.float16,
|
| 52 |
+
"trust_remote_code": True
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
# GPU kontrolü
|
| 56 |
+
if torch.cuda.is_available():
|
| 57 |
+
print("🎮 GPU tespit edildi, GPU kullanılacak")
|
| 58 |
+
load_kwargs["device_map"] = "auto"
|
| 59 |
+
else:
|
| 60 |
+
print("💻 CPU kullanılacak")
|
| 61 |
+
load_kwargs["device_map"] = None
|
| 62 |
+
|
| 63 |
+
# Model yükle
|
| 64 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 65 |
+
model_path,
|
| 66 |
+
**load_kwargs
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
print(f"✅ {model_name} başarıyla yüklendi!")
|
| 70 |
+
return model, tokenizer
|
| 71 |
+
|
| 72 |
+
except Exception as e:
|
| 73 |
+
print(f"❌ Model yükleme hatası: {e}")
|
| 74 |
+
return None, None
|
| 75 |
+
|
| 76 |
+
def chat_with_nova(message, model, tokenizer, max_tokens=256):
|
| 77 |
+
"""Nova AI ile sohbet et"""
|
| 78 |
+
try:
|
| 79 |
+
# Konuşma formatı
|
| 80 |
+
conversation = f"Kullanıcı: {message}\nNova AI:"
|
| 81 |
+
|
| 82 |
+
# Tokenize
|
| 83 |
+
inputs = tokenizer(
|
| 84 |
+
conversation,
|
| 85 |
+
return_tensors="pt",
|
| 86 |
+
truncation=True,
|
| 87 |
+
max_length=1024
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
# GPU'ya taşı (eğer varsa)
|
| 91 |
+
if model.device.type != 'cpu':
|
| 92 |
+
inputs = inputs.to(model.device)
|
| 93 |
+
|
| 94 |
+
# Yanıt üret
|
| 95 |
+
with torch.no_grad():
|
| 96 |
+
outputs = model.generate(
|
| 97 |
+
**inputs,
|
| 98 |
+
max_new_tokens=max_tokens,
|
| 99 |
+
temperature=0.7,
|
| 100 |
+
top_p=0.9,
|
| 101 |
+
do_sample=True,
|
| 102 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 103 |
+
eos_token_id=tokenizer.eos_token_id
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
# Decode et
|
| 107 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 108 |
+
nova_response = response[len(conversation):].strip()
|
| 109 |
+
|
| 110 |
+
return nova_response if nova_response else "Üzgünüm, yanıt üretemedi."
|
| 111 |
+
|
| 112 |
+
except Exception as e:
|
| 113 |
+
return f"❌ Hata: {e}"
|
| 114 |
+
|
| 115 |
+
def main():
|
| 116 |
+
"""Ana uygulama"""
|
| 117 |
+
print("=" * 50)
|
| 118 |
+
print("🚀 NOVA AI - BASİT KONSOL UYGULAMASI")
|
| 119 |
+
print("🌟 Teknova Özgün Yapay Zeka Modeli")
|
| 120 |
+
print("=" * 50)
|
| 121 |
+
|
| 122 |
+
# Model seçimi
|
| 123 |
+
model_path, model_name = select_model()
|
| 124 |
+
|
| 125 |
+
# Modeli yükle
|
| 126 |
+
model, tokenizer = load_model(model_path, model_name)
|
| 127 |
+
|
| 128 |
+
if model is None or tokenizer is None:
|
| 129 |
+
print("❌ Program sonlandırılıyor.")
|
| 130 |
+
return
|
| 131 |
+
|
| 132 |
+
print(f"\n🎉 {model_name} ile sohbet hazır!")
|
| 133 |
+
print("💬 Komutlar:")
|
| 134 |
+
print(" - Mesaj yazarak sohbet edin")
|
| 135 |
+
print(" - 'exit' yazarak çıkın")
|
| 136 |
+
print(" - 'model' yazarak model değiştirin")
|
| 137 |
+
print("-" * 50)
|
| 138 |
+
|
| 139 |
+
while True:
|
| 140 |
+
try:
|
| 141 |
+
user_input = input("\n👤 Siz: ").strip()
|
| 142 |
+
|
| 143 |
+
# Çıkış komutları
|
| 144 |
+
if user_input.lower() in ['exit', 'çıkış', 'quit', 'q']:
|
| 145 |
+
print("\n🚀 Nova AI - Görüşmek üzere!")
|
| 146 |
+
break
|
| 147 |
+
|
| 148 |
+
# Model değiştirme
|
| 149 |
+
if user_input.lower() == 'model':
|
| 150 |
+
print("\n🔄 Model değiştiriliyor...")
|
| 151 |
+
model_path, model_name = select_model()
|
| 152 |
+
model, tokenizer = load_model(model_path, model_name)
|
| 153 |
+
if model is None:
|
| 154 |
+
continue
|
| 155 |
+
print(f"✅ {model_name} aktif!")
|
| 156 |
+
continue
|
| 157 |
+
|
| 158 |
+
# Boş mesaj kontrolü
|
| 159 |
+
if not user_input:
|
| 160 |
+
print("🤖 Nova AI: Lütfen bir mesaj yazın.")
|
| 161 |
+
continue
|
| 162 |
+
|
| 163 |
+
# Nova AI'dan yanıt al
|
| 164 |
+
print("🤖 Nova AI düşünüyor...")
|
| 165 |
+
response = chat_with_nova(user_input, model, tokenizer)
|
| 166 |
+
print(f"🤖 Nova AI: {response}")
|
| 167 |
+
|
| 168 |
+
except KeyboardInterrupt:
|
| 169 |
+
print("\n\n🚀 Nova AI - Program sonlandırıldı!")
|
| 170 |
+
break
|
| 171 |
+
except Exception as e:
|
| 172 |
+
print(f"❌ Beklenmeyen hata: {e}")
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__":
|
| 175 |
+
main()
|
baslat_basit_konsol.bat
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
chcp 65001 >nul
|
| 3 |
+
|
| 4 |
+
:: Teknova Nova AI - Basit Konsol Uygulaması Başlatma Betiği
|
| 5 |
+
|
| 6 |
+
title Teknova Nova AI - Basit Konsol
|
| 7 |
+
|
| 8 |
+
echo.
|
| 9 |
+
echo 🚀 =======================================
|
| 10 |
+
echo TEKNOVA NOVA AI BASİT KONSOL
|
| 11 |
+
echo Özgün yapay zeka teknolojisi
|
| 12 |
+
echo =======================================
|
| 13 |
+
echo.
|
| 14 |
+
echo 🌟 Bu tamamen özgün bir Teknova Nova AI modelidir!
|
| 15 |
+
echo 💡 Hugging Face token gerektirmez - Kendi modeliniz!
|
| 16 |
+
echo ⚡ Basit konsol uygulaması başlatılıyor...
|
| 17 |
+
echo.
|
| 18 |
+
|
| 19 |
+
:: Model klasörleri kontrolü
|
| 20 |
+
echo 📂 Model konumu kontrol ediliyor:
|
| 21 |
+
if exist "nova-ai-model" (
|
| 22 |
+
echo ✅ Büyük model dosyaları bulundu (nova-ai-model)
|
| 23 |
+
) else (
|
| 24 |
+
echo ⚠️ Büyük model dosyaları bulunamadı (nova-ai-model)
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
echo 🌐 Hub modeli de desteklenmektedir (veteroner/NovaAI)
|
| 28 |
+
|
| 29 |
+
echo.
|
| 30 |
+
echo 💬 Basit konsol uygulaması başlatılıyor...
|
| 31 |
+
echo 🎯 Model seçimi yapabilir, sohbet edebilirsiniz
|
| 32 |
+
echo ⏹️ Çıkmak için 'exit' yazın
|
| 33 |
+
|
| 34 |
+
echo.
|
| 35 |
+
|
| 36 |
+
:: ================== Sanal ortam kontrolü ==================
|
| 37 |
+
if exist "venv311\Scripts\python.exe" (
|
| 38 |
+
echo 🐍 Sanal ortam bulundu: venv311
|
| 39 |
+
set "PY_EXE=venv311\Scripts\python.exe"
|
| 40 |
+
) else (
|
| 41 |
+
echo ⚠️ venv311 bulunamadı, sistem Python kullanılacak
|
| 42 |
+
set "PY_EXE=python"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
%PY_EXE% basit_konsol.py
|
| 46 |
+
|
| 47 |
+
echo.
|
| 48 |
+
echo 🚀 Teknova Nova AI - Basit konsol uygulaması kapatıldı
|
| 49 |
+
echo 💡 Tekrar çalıştırmak için bu dosyayı çalıştırın
|
| 50 |
+
pause
|
baslat_gradio.bat
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
chcp 65001 >nul
|
| 3 |
+
|
| 4 |
+
:: Teknova Nova AI - Gradio Arayüzü Başlatma Betiği
|
| 5 |
+
|
| 6 |
+
title Teknova Nova AI - Gradio Arayüzü
|
| 7 |
+
|
| 8 |
+
echo.
|
| 9 |
+
echo 🚀 =======================================
|
| 10 |
+
echo TEKNOVA NOVA AI GRADIO ARAYÜZÜ
|
| 11 |
+
echo Özgün yapay zeka teknolojisi
|
| 12 |
+
echo =======================================
|
| 13 |
+
echo.
|
| 14 |
+
echo 🌟 Bu tamamen özgün bir Teknova Nova AI modelidir!
|
| 15 |
+
echo 💡 Hugging Face token gerektirmez - Kendi modeliniz!
|
| 16 |
+
echo ⚡ Gradio arayüzü başlatılıyor...
|
| 17 |
+
echo.
|
| 18 |
+
|
| 19 |
+
:: Model klasörleri kontrolü
|
| 20 |
+
echo 📂 Model konumu kontrol ediliyor:
|
| 21 |
+
if exist "nova-ai-model" (
|
| 22 |
+
echo ✅ Büyük model dosyaları bulundu (nova-ai-model)
|
| 23 |
+
) else (
|
| 24 |
+
echo ⚠️ Büyük model dosyaları bulunamadı (nova-ai-model)
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
echo 🌐 Hub modeli de desteklenmektedir (veteroner/NovaAI)
|
| 28 |
+
|
| 29 |
+
echo.
|
| 30 |
+
echo 🌐 Gradio arayüzü başlatılıyor...
|
| 31 |
+
echo 💻 Tarayıcınızda açılacak adres: http://localhost:7860
|
| 32 |
+
|
| 33 |
+
echo ⏹️ Durdurmak için Ctrl+C tuşlayın
|
| 34 |
+
|
| 35 |
+
echo.
|
| 36 |
+
|
| 37 |
+
:: ================== Sanal ortam kontrolü ==================
|
| 38 |
+
if exist "venv311\Scripts\python.exe" (
|
| 39 |
+
echo 🐍 Sanal ortam bulundu: venv311
|
| 40 |
+
set "PY_EXE=venv311\Scripts\python.exe"
|
| 41 |
+
) else (
|
| 42 |
+
echo ⚠️ venv311 bulunamadı, sistem Python kullanılacak
|
| 43 |
+
set "PY_EXE=python"
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
%PY_EXE% gradio_app.py
|
| 47 |
+
|
| 48 |
+
echo.
|
| 49 |
+
echo 🚀 Teknova Nova AI - Gradio arayüzü kapatıldı
|
| 50 |
+
echo 💡 Tekrar çalıştırmak için bu dosyayı çalıştırın
|
| 51 |
+
pause
|
chat.html
DELETED
|
@@ -1,422 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="tr">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Nova AI Chat - Teknova</title>
|
| 7 |
-
<style>
|
| 8 |
-
* {
|
| 9 |
-
margin: 0;
|
| 10 |
-
padding: 0;
|
| 11 |
-
box-sizing: border-box;
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
body {
|
| 15 |
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 16 |
-
background: #f7f7f8;
|
| 17 |
-
height: 100vh;
|
| 18 |
-
display: flex;
|
| 19 |
-
flex-direction: column;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
.header {
|
| 23 |
-
background: #fff;
|
| 24 |
-
border-bottom: 1px solid #e5e5e5;
|
| 25 |
-
padding: 1rem 2rem;
|
| 26 |
-
display: flex;
|
| 27 |
-
align-items: center;
|
| 28 |
-
justify-content: center;
|
| 29 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
.header h1 {
|
| 33 |
-
color: #202123;
|
| 34 |
-
font-size: 1.5rem;
|
| 35 |
-
font-weight: 600;
|
| 36 |
-
display: flex;
|
| 37 |
-
align-items: center;
|
| 38 |
-
gap: 0.5rem;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
.ai-icon {
|
| 42 |
-
width: 32px;
|
| 43 |
-
height: 32px;
|
| 44 |
-
background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
|
| 45 |
-
border-radius: 8px;
|
| 46 |
-
display: flex;
|
| 47 |
-
align-items: center;
|
| 48 |
-
justify-content: center;
|
| 49 |
-
color: white;
|
| 50 |
-
font-weight: bold;
|
| 51 |
-
font-size: 1.2rem;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.company-tag {
|
| 55 |
-
background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
|
| 56 |
-
color: white;
|
| 57 |
-
padding: 0.25rem 0.5rem;
|
| 58 |
-
border-radius: 12px;
|
| 59 |
-
font-size: 0.75rem;
|
| 60 |
-
margin-left: 0.5rem;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.chat-container {
|
| 64 |
-
flex: 1;
|
| 65 |
-
display: flex;
|
| 66 |
-
flex-direction: column;
|
| 67 |
-
max-width: 768px;
|
| 68 |
-
margin: 0 auto;
|
| 69 |
-
width: 100%;
|
| 70 |
-
height: 100%;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
.messages {
|
| 74 |
-
flex: 1;
|
| 75 |
-
overflow-y: auto;
|
| 76 |
-
padding: 2rem 1rem;
|
| 77 |
-
display: flex;
|
| 78 |
-
flex-direction: column;
|
| 79 |
-
gap: 1.5rem;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
.message {
|
| 83 |
-
display: flex;
|
| 84 |
-
gap: 1rem;
|
| 85 |
-
animation: fadeIn 0.3s ease-in;
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
.message.user {
|
| 89 |
-
flex-direction: row-reverse;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
.avatar {
|
| 93 |
-
width: 40px;
|
| 94 |
-
height: 40px;
|
| 95 |
-
border-radius: 50%;
|
| 96 |
-
display: flex;
|
| 97 |
-
align-items: center;
|
| 98 |
-
justify-content: center;
|
| 99 |
-
font-weight: 600;
|
| 100 |
-
font-size: 0.9rem;
|
| 101 |
-
flex-shrink: 0;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
.user .avatar {
|
| 105 |
-
background: #19c37d;
|
| 106 |
-
color: white;
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
.bot .avatar {
|
| 110 |
-
background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
|
| 111 |
-
color: white;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
.message-content {
|
| 115 |
-
background: #fff;
|
| 116 |
-
padding: 1rem 1.25rem;
|
| 117 |
-
border-radius: 18px;
|
| 118 |
-
max-width: 70%;
|
| 119 |
-
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 120 |
-
line-height: 1.5;
|
| 121 |
-
word-wrap: break-word;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
.user .message-content {
|
| 125 |
-
background: #19c37d;
|
| 126 |
-
color: white;
|
| 127 |
-
border-bottom-right-radius: 4px;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
.bot .message-content {
|
| 131 |
-
border-bottom-left-radius: 4px;
|
| 132 |
-
border: 1px solid #e5e5e5;
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
.input-container {
|
| 136 |
-
padding: 1rem;
|
| 137 |
-
background: #fff;
|
| 138 |
-
border-top: 1px solid #e5e5e5;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
.input-form {
|
| 142 |
-
max-width: 768px;
|
| 143 |
-
margin: 0 auto;
|
| 144 |
-
display: flex;
|
| 145 |
-
gap: 0.75rem;
|
| 146 |
-
background: #f4f4f4;
|
| 147 |
-
border-radius: 24px;
|
| 148 |
-
padding: 0.5rem;
|
| 149 |
-
border: 1px solid #e5e5e5;
|
| 150 |
-
transition: all 0.2s ease;
|
| 151 |
-
}
|
| 152 |
-
|
| 153 |
-
.input-form:focus-within {
|
| 154 |
-
border-color: #ff6b6b;
|
| 155 |
-
box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
.message-input {
|
| 159 |
-
flex: 1;
|
| 160 |
-
border: none;
|
| 161 |
-
background: transparent;
|
| 162 |
-
padding: 0.75rem 1rem;
|
| 163 |
-
font-size: 1rem;
|
| 164 |
-
outline: none;
|
| 165 |
-
resize: none;
|
| 166 |
-
max-height: 120px;
|
| 167 |
-
min-height: 24px;
|
| 168 |
-
font-family: inherit;
|
| 169 |
-
}
|
| 170 |
-
|
| 171 |
-
.send-button {
|
| 172 |
-
background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
|
| 173 |
-
border: none;
|
| 174 |
-
color: white;
|
| 175 |
-
width: 36px;
|
| 176 |
-
height: 36px;
|
| 177 |
-
border-radius: 18px;
|
| 178 |
-
cursor: pointer;
|
| 179 |
-
display: flex;
|
| 180 |
-
align-items: center;
|
| 181 |
-
justify-content: center;
|
| 182 |
-
transition: all 0.2s ease;
|
| 183 |
-
flex-shrink: 0;
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
.send-button:hover:not(:disabled) {
|
| 187 |
-
transform: scale(1.05);
|
| 188 |
-
box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
.send-button:disabled {
|
| 192 |
-
background: #d1d5db;
|
| 193 |
-
cursor: not-allowed;
|
| 194 |
-
transform: none;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.loading {
|
| 198 |
-
display: flex;
|
| 199 |
-
align-items: center;
|
| 200 |
-
gap: 0.5rem;
|
| 201 |
-
color: #6b7280;
|
| 202 |
-
font-style: italic;
|
| 203 |
-
}
|
| 204 |
-
|
| 205 |
-
.typing-indicator {
|
| 206 |
-
display: flex;
|
| 207 |
-
gap: 4px;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
.typing-dot {
|
| 211 |
-
width: 8px;
|
| 212 |
-
height: 8px;
|
| 213 |
-
border-radius: 50%;
|
| 214 |
-
background: #9ca3af;
|
| 215 |
-
animation: typing 1.4s infinite ease-in-out;
|
| 216 |
-
}
|
| 217 |
-
|
| 218 |
-
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
|
| 219 |
-
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
|
| 220 |
-
|
| 221 |
-
@keyframes typing {
|
| 222 |
-
0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
|
| 223 |
-
40% { transform: scale(1); opacity: 1; }
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
@keyframes fadeIn {
|
| 227 |
-
from { opacity: 0; transform: translateY(10px); }
|
| 228 |
-
to { opacity: 1; transform: translateY(0); }
|
| 229 |
-
}
|
| 230 |
-
|
| 231 |
-
.welcome-message {
|
| 232 |
-
text-align: center;
|
| 233 |
-
color: #6b7280;
|
| 234 |
-
margin: 2rem 0;
|
| 235 |
-
padding: 2rem;
|
| 236 |
-
}
|
| 237 |
-
|
| 238 |
-
.welcome-message h2 {
|
| 239 |
-
font-size: 1.5rem;
|
| 240 |
-
margin-bottom: 0.5rem;
|
| 241 |
-
color: #374151;
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
.welcome-message p {
|
| 245 |
-
font-size: 1rem;
|
| 246 |
-
line-height: 1.6;
|
| 247 |
-
}
|
| 248 |
-
|
| 249 |
-
.welcome-message .brand {
|
| 250 |
-
color: #ff6b6b;
|
| 251 |
-
font-weight: 600;
|
| 252 |
-
}
|
| 253 |
-
|
| 254 |
-
@media (max-width: 768px) {
|
| 255 |
-
.header {
|
| 256 |
-
padding: 1rem;
|
| 257 |
-
}
|
| 258 |
-
|
| 259 |
-
.messages {
|
| 260 |
-
padding: 1rem 0.5rem;
|
| 261 |
-
}
|
| 262 |
-
|
| 263 |
-
.input-container {
|
| 264 |
-
padding: 0.5rem;
|
| 265 |
-
}
|
| 266 |
-
|
| 267 |
-
.message-content {
|
| 268 |
-
max-width: 85%;
|
| 269 |
-
}
|
| 270 |
-
}
|
| 271 |
-
</style>
|
| 272 |
-
</head>
|
| 273 |
-
<body>
|
| 274 |
-
<div class="header">
|
| 275 |
-
<h1>
|
| 276 |
-
<div class="ai-icon">N</div>
|
| 277 |
-
Nova AI
|
| 278 |
-
<span class="company-tag">by Teknova</span>
|
| 279 |
-
</h1>
|
| 280 |
-
</div>
|
| 281 |
-
|
| 282 |
-
<div class="chat-container">
|
| 283 |
-
<div class="messages" id="messages">
|
| 284 |
-
<div class="welcome-message">
|
| 285 |
-
<h2>👋 Merhaba!</h2>
|
| 286 |
-
<p>Ben <span class="brand">Nova AI</span>, <strong>Teknova</strong> tarafından geliştirilen yapay zeka asistanınızım.</p>
|
| 287 |
-
<p>Size nasıl yardımcı olabilirim?</p>
|
| 288 |
-
</div>
|
| 289 |
-
</div>
|
| 290 |
-
|
| 291 |
-
<div class="input-container">
|
| 292 |
-
<form class="input-form" id="chat-form">
|
| 293 |
-
<textarea
|
| 294 |
-
class="message-input"
|
| 295 |
-
id="prompt"
|
| 296 |
-
placeholder="Nova AI'ya bir mesaj yazın..."
|
| 297 |
-
rows="1"
|
| 298 |
-
required
|
| 299 |
-
></textarea>
|
| 300 |
-
<button type="submit" class="send-button" id="send-button">
|
| 301 |
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
| 302 |
-
<path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
|
| 303 |
-
</svg>
|
| 304 |
-
</button>
|
| 305 |
-
</form>
|
| 306 |
-
</div>
|
| 307 |
-
</div>
|
| 308 |
-
|
| 309 |
-
<script>
|
| 310 |
-
const form = document.getElementById('chat-form');
|
| 311 |
-
const promptInput = document.getElementById('prompt');
|
| 312 |
-
const messagesDiv = document.getElementById('messages');
|
| 313 |
-
const sendButton = document.getElementById('send-button');
|
| 314 |
-
let loading = false;
|
| 315 |
-
|
| 316 |
-
// Auto-resize textarea
|
| 317 |
-
promptInput.addEventListener('input', function() {
|
| 318 |
-
this.style.height = 'auto';
|
| 319 |
-
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
|
| 320 |
-
});
|
| 321 |
-
|
| 322 |
-
// Send on Enter (but allow Shift+Enter for new lines)
|
| 323 |
-
promptInput.addEventListener('keydown', function(e) {
|
| 324 |
-
if (e.key === 'Enter' && !e.shiftKey) {
|
| 325 |
-
e.preventDefault();
|
| 326 |
-
form.dispatchEvent(new Event('submit'));
|
| 327 |
-
}
|
| 328 |
-
});
|
| 329 |
-
|
| 330 |
-
function addMessage(text, sender, isLoading = false) {
|
| 331 |
-
const messageDiv = document.createElement('div');
|
| 332 |
-
messageDiv.className = `message ${sender}`;
|
| 333 |
-
|
| 334 |
-
const avatar = document.createElement('div');
|
| 335 |
-
avatar.className = 'avatar';
|
| 336 |
-
avatar.textContent = sender === 'user' ? 'S' : 'N';
|
| 337 |
-
|
| 338 |
-
const content = document.createElement('div');
|
| 339 |
-
content.className = 'message-content';
|
| 340 |
-
|
| 341 |
-
if (isLoading) {
|
| 342 |
-
content.innerHTML = `
|
| 343 |
-
<div class="loading">
|
| 344 |
-
<div class="typing-indicator">
|
| 345 |
-
<div class="typing-dot"></div>
|
| 346 |
-
<div class="typing-dot"></div>
|
| 347 |
-
<div class="typing-dot"></div>
|
| 348 |
-
</div>
|
| 349 |
-
Nova AI düşünüyor...
|
| 350 |
-
</div>
|
| 351 |
-
`;
|
| 352 |
-
} else {
|
| 353 |
-
content.textContent = text;
|
| 354 |
-
}
|
| 355 |
-
|
| 356 |
-
messageDiv.appendChild(avatar);
|
| 357 |
-
messageDiv.appendChild(content);
|
| 358 |
-
messagesDiv.appendChild(messageDiv);
|
| 359 |
-
|
| 360 |
-
// Remove welcome message on first user message
|
| 361 |
-
if (sender === 'user') {
|
| 362 |
-
const welcome = messagesDiv.querySelector('.welcome-message');
|
| 363 |
-
if (welcome) welcome.remove();
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
messagesDiv.scrollTop = messagesDiv.scrollHeight;
|
| 367 |
-
return content;
|
| 368 |
-
}
|
| 369 |
-
|
| 370 |
-
form.onsubmit = async (e) => {
|
| 371 |
-
e.preventDefault();
|
| 372 |
-
if (loading) return;
|
| 373 |
-
|
| 374 |
-
const prompt = promptInput.value.trim();
|
| 375 |
-
if (!prompt) return;
|
| 376 |
-
|
| 377 |
-
// Add user message
|
| 378 |
-
addMessage(prompt, 'user');
|
| 379 |
-
|
| 380 |
-
// Clear input and reset height
|
| 381 |
-
promptInput.value = '';
|
| 382 |
-
promptInput.style.height = 'auto';
|
| 383 |
-
|
| 384 |
-
// Add loading message
|
| 385 |
-
const loadingContent = addMessage('', 'bot', true);
|
| 386 |
-
|
| 387 |
-
loading = true;
|
| 388 |
-
sendButton.disabled = true;
|
| 389 |
-
|
| 390 |
-
try {
|
| 391 |
-
const res = await fetch('http://localhost:8500/chat', {
|
| 392 |
-
method: 'POST',
|
| 393 |
-
headers: { 'Content-Type': 'application/json' },
|
| 394 |
-
body: JSON.stringify({ prompt })
|
| 395 |
-
});
|
| 396 |
-
|
| 397 |
-
if (!res.ok) {
|
| 398 |
-
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
| 399 |
-
}
|
| 400 |
-
|
| 401 |
-
const data = await res.json();
|
| 402 |
-
loadingContent.textContent = data.response || 'Üzgünüm, bir yanıt alamadım.';
|
| 403 |
-
|
| 404 |
-
} catch (err) {
|
| 405 |
-
loadingContent.innerHTML = `
|
| 406 |
-
<div style="color: #ef4444;">
|
| 407 |
-
❌ Bağlantı hatası: ${err.message}
|
| 408 |
-
<br><small>Lütfen Nova AI sunucusunun çalıştığından emin olun.</small>
|
| 409 |
-
</div>
|
| 410 |
-
`;
|
| 411 |
-
}
|
| 412 |
-
|
| 413 |
-
loading = false;
|
| 414 |
-
sendButton.disabled = false;
|
| 415 |
-
promptInput.focus();
|
| 416 |
-
};
|
| 417 |
-
|
| 418 |
-
// Focus input on load
|
| 419 |
-
window.onload = () => promptInput.focus();
|
| 420 |
-
</script>
|
| 421 |
-
</body>
|
| 422 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download_mistral.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
# Teknova Nova AI Model İndirme Scripti
|
| 2 |
-
# Bu script kendi Nova AI modelinizi yerel klasöre indirir
|
| 3 |
-
from huggingface_hub import snapshot_download
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
-
# Nova AI Model bilgileri - Kendi modeliniz
|
| 7 |
-
MODEL_NAME = "your-username/nova-ai-model" # Kendi Hugging Face model adresinizi yazın
|
| 8 |
-
LOCAL_DIR = "nova-ai-model"
|
| 9 |
-
|
| 10 |
-
print("🚀 Teknova Nova AI Model İndirme Scripti")
|
| 11 |
-
print("🌟 Bu script kendi Nova AI modelinizi indirir")
|
| 12 |
-
print("=" * 60)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
print(f"📦 Nova AI modeli indiriliyor: {MODEL_NAME}")
|
| 16 |
-
print(f"📂 Hedef klasör: {LOCAL_DIR}")
|
| 17 |
-
print("💡 Bu işlem biraz zaman alabilir...")
|
| 18 |
-
|
| 19 |
-
try:
|
| 20 |
-
# Nova AI modelinizi indirin
|
| 21 |
-
snapshot_download(
|
| 22 |
-
repo_id=MODEL_NAME,
|
| 23 |
-
local_dir=LOCAL_DIR,
|
| 24 |
-
local_dir_use_symlinks=False
|
| 25 |
-
)
|
| 26 |
-
print(f"✅ Nova AI modeli '{MODEL_NAME}' başarıyla '{LOCAL_DIR}' klasörüne indirildi!")
|
| 27 |
-
print("🎉 Artık Nova AI uygulamanızı çalıştırabilirsiniz!")
|
| 28 |
-
|
| 29 |
-
except Exception as e:
|
| 30 |
-
print(f"❌ Nova AI model indirme hatası: {e}")
|
| 31 |
-
print("\n💡 Çözüm önerileri:")
|
| 32 |
-
print("1. MODEL_NAME değişkenini kendi model adresinizle değiştirin")
|
| 33 |
-
print("2. Hugging Face token'ınızı ayarlayın (gerekirse)")
|
| 34 |
-
print("3. İnternet bağlantınızı kontrol edin")
|
| 35 |
-
print("4. Model adresinin doğru olduğundan emin olun")
|
| 36 |
-
|
| 37 |
-
print("\n🚀 Teknova Nova AI ile güçlendirilmiştir!")
|
| 38 |
-
input("Press Enter to continue...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gradio_app.py
CHANGED
|
@@ -26,7 +26,7 @@ def load_model():
|
|
| 26 |
"""Teknova Nova AI modelini yükle - ZeroGPU destekli."""
|
| 27 |
global model, tokenizer
|
| 28 |
|
| 29 |
-
model_path = "
|
| 30 |
print(f"🚀 Nova AI modeli yükleniyor... ({model_path})")
|
| 31 |
|
| 32 |
try:
|
|
|
|
| 26 |
"""Teknova Nova AI modelini yükle - ZeroGPU destekli."""
|
| 27 |
global model, tokenizer
|
| 28 |
|
| 29 |
+
model_path = "nova-ai-model"
|
| 30 |
print(f"🚀 Nova AI modeli yükleniyor... ({model_path})")
|
| 31 |
|
| 32 |
try:
|
hf_README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Nova AI
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.11.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# 🚀 Teknova Nova AI
|
| 14 |
-
|
| 15 |
-
**Özgün yapay zeka teknolojisi - Hugging Face Spaces'te canlı!**
|
| 16 |
-
|
| 17 |
-
## 🌟 Özellikler
|
| 18 |
-
|
| 19 |
-
- 🧠 **Gelişmiş Dil Modeli** - Teknova'nın özgün AI teknolojisi
|
| 20 |
-
- 💬 **Doğal Konuşma** - İnsan benzeri etkileşim
|
| 21 |
-
- 🌍 **Türkçe Optimizasyonu** - Ana dil Türkçe
|
| 22 |
-
- ⚡ **Hızlı Yanıt** - Optimize edilmiş performans
|
| 23 |
-
- 🎛️ **Ayarlanabilir Parametreler** - Temperature ve uzunluk kontrolü
|
| 24 |
-
|
| 25 |
-
## 🚀 Kullanım
|
| 26 |
-
|
| 27 |
-
1. **Mesajınızı yazın** - Text kutusuna sorunuzu girin
|
| 28 |
-
2. **Gönder** - Butona basın veya Enter'a basın
|
| 29 |
-
3. **Yanıt alın** - Nova AI'den hızlı yanıt
|
| 30 |
-
|
| 31 |
-
### 💡 Örnek Sorular
|
| 32 |
-
|
| 33 |
-
- "Merhaba Nova AI!"
|
| 34 |
-
- "Yapay zeka nedir?"
|
| 35 |
-
- "Teknova hakkında bilgi ver"
|
| 36 |
-
- "Bana proje fikirleri öner"
|
| 37 |
-
|
| 38 |
-
## ⚙️ Ayarlar
|
| 39 |
-
|
| 40 |
-
- **Maksimum Uzunluk**: Yanıtın uzunluğunu kontrol eder
|
| 41 |
-
- **Temperature**: Yaratıcılık seviyesi (0.1 = tutarlı, 1.2 = yaratıcı)
|
| 42 |
-
|
| 43 |
-
## 🔗 Linkler
|
| 44 |
-
|
| 45 |
-
- **GitHub**: [veteroner/novaai](https://github.com/veteroner/novaai)
|
| 46 |
-
- **Website**: [teknova.com](https://teknova.com)
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
**Made with ❤️ by Teknova**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hf_app.py
DELETED
|
@@ -1,345 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
🚀 Nova AI - Hugging Face Spaces
|
| 3 |
-
Teknova tarafından geliştirilen özgün yapay zeka modeli
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import gradio as gr
|
| 7 |
-
import torch
|
| 8 |
-
import os
|
| 9 |
-
import logging
|
| 10 |
-
import time
|
| 11 |
-
from typing import List, Tuple
|
| 12 |
-
|
| 13 |
-
# Logging setup
|
| 14 |
-
logging.basicConfig(level=logging.INFO)
|
| 15 |
-
logger = logging.getLogger(__name__)
|
| 16 |
-
|
| 17 |
-
# Global variables
|
| 18 |
-
model = None
|
| 19 |
-
tokenizer = None
|
| 20 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 21 |
-
|
| 22 |
-
def load_demo_responses():
|
| 23 |
-
"""
|
| 24 |
-
Demo yanıtları - model yokken kullanılacak
|
| 25 |
-
"""
|
| 26 |
-
demo_responses = {
|
| 27 |
-
"merhaba": "Merhaba! Ben Nova AI, Teknova'nın özgün yapay zeka teknolojisi. Size nasıl yardımcı olabilirim?",
|
| 28 |
-
"nasılsın": "Ben Nova AI'yım ve harika hissediyorum! Sizinle sohbet etmek için buradayım. Ne konuşmak istersiniz?",
|
| 29 |
-
"nova ai nedir": "Nova AI, Teknova tarafından geliştirilen özgün bir yapay zeka modelidir. Türkçe konuşabilir ve çeşitli konularda yardımcı olabilirim.",
|
| 30 |
-
"teknova": "Teknova, Türkiye'nin öncü yapay zeka teknoloji şirketidir. Özgün AI çözümleri geliştiriyoruz.",
|
| 31 |
-
"yapay zeka": "Yapay zeka, bilgisayarların insan benzeri düşünme ve öğrenme yetenekleri göstermesidir. Ben de bir yapay zeka örneğiyim!",
|
| 32 |
-
"projeler": "Size yenilikçi proje fikirleri önerebilirim: AI chatbot, veri analizi, web uygulaması, mobil uygulama gibi...",
|
| 33 |
-
"gelecek": "Gelecekte yapay zeka, otonom araçlar, akıllı şehirler ve personalize eğitim gibi alanlarda devrim yaratacak!"
|
| 34 |
-
}
|
| 35 |
-
return demo_responses
|
| 36 |
-
|
| 37 |
-
def generate_demo_response(message: str) -> str:
|
| 38 |
-
"""
|
| 39 |
-
Demo yanıt oluştur (model olmadığında)
|
| 40 |
-
"""
|
| 41 |
-
message_lower = message.lower().strip()
|
| 42 |
-
demo_responses = load_demo_responses()
|
| 43 |
-
|
| 44 |
-
# Exact match
|
| 45 |
-
if message_lower in demo_responses:
|
| 46 |
-
return demo_responses[message_lower]
|
| 47 |
-
|
| 48 |
-
# Partial match
|
| 49 |
-
for key, response in demo_responses.items():
|
| 50 |
-
if key in message_lower:
|
| 51 |
-
return response
|
| 52 |
-
|
| 53 |
-
# Default responses
|
| 54 |
-
if "?" in message:
|
| 55 |
-
return f"'{message}' hakkında çok ilginç bir soru sordunuz! Nova AI olarak elimden geldiğince yardımcı olmaya çalışırım. Bu konuda daha spesifik sorular sorabilirsiniz."
|
| 56 |
-
|
| 57 |
-
return f"Nova AI burada! '{message}' konusunda konuşmak güzel. Size nasıl yardımcı olabilirim? Daha detaylı sorular sorabilirsiniz."
|
| 58 |
-
|
| 59 |
-
def chat_response(message: str, history: List[List[str]], max_length: int, temperature: float) -> Tuple[str, List[List[str]]]:
|
| 60 |
-
"""
|
| 61 |
-
Chat response function
|
| 62 |
-
"""
|
| 63 |
-
if not message.strip():
|
| 64 |
-
return "", history
|
| 65 |
-
|
| 66 |
-
# Simulate thinking time
|
| 67 |
-
time.sleep(0.5)
|
| 68 |
-
|
| 69 |
-
# Generate response
|
| 70 |
-
if model and tokenizer:
|
| 71 |
-
# Gerçek model ile yanıt (model yüklü ise)
|
| 72 |
-
try:
|
| 73 |
-
response = generate_real_response(message, max_length, temperature)
|
| 74 |
-
except Exception as e:
|
| 75 |
-
response = f"Model hatası: {str(e)} - Demo moduna geçiliyor..."
|
| 76 |
-
response += "\n\n" + generate_demo_response(message)
|
| 77 |
-
else:
|
| 78 |
-
# Demo yanıt
|
| 79 |
-
response = generate_demo_response(message)
|
| 80 |
-
response += "\n\n💡 *Not: Bu demo modunda çalışıyor. Gerçek Nova AI modeli yüklendiğinde daha gelişmiş yanıtlar alacaksınız.*"
|
| 81 |
-
|
| 82 |
-
# Add to history
|
| 83 |
-
history.append([message, response])
|
| 84 |
-
return "", history
|
| 85 |
-
|
| 86 |
-
def generate_real_response(message: str, max_length: int, temperature: float) -> str:
|
| 87 |
-
"""
|
| 88 |
-
Gerçek model ile yanıt oluştur
|
| 89 |
-
"""
|
| 90 |
-
if not model or not tokenizer:
|
| 91 |
-
return generate_demo_response(message)
|
| 92 |
-
|
| 93 |
-
try:
|
| 94 |
-
inputs = tokenizer.encode(message, return_tensors="pt")
|
| 95 |
-
if device == "cuda":
|
| 96 |
-
inputs = inputs.to(device)
|
| 97 |
-
|
| 98 |
-
with torch.no_grad():
|
| 99 |
-
outputs = model.generate(
|
| 100 |
-
inputs,
|
| 101 |
-
max_length=max_length,
|
| 102 |
-
temperature=temperature,
|
| 103 |
-
do_sample=True,
|
| 104 |
-
pad_token_id=tokenizer.eos_token_id,
|
| 105 |
-
no_repeat_ngram_size=3,
|
| 106 |
-
top_p=0.9
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 110 |
-
if message in response:
|
| 111 |
-
response = response.replace(message, "").strip()
|
| 112 |
-
|
| 113 |
-
return response if response else generate_demo_response(message)
|
| 114 |
-
|
| 115 |
-
except Exception as e:
|
| 116 |
-
logger.error(f"Model generation error: {e}")
|
| 117 |
-
return generate_demo_response(message)
|
| 118 |
-
|
| 119 |
-
def load_model():
|
| 120 |
-
"""
|
| 121 |
-
Model yükleme (opsiyonel)
|
| 122 |
-
"""
|
| 123 |
-
global model, tokenizer
|
| 124 |
-
|
| 125 |
-
try:
|
| 126 |
-
# Model path'leri
|
| 127 |
-
possible_paths = [
|
| 128 |
-
"/data/nova-ai-model",
|
| 129 |
-
"./nova-ai-model",
|
| 130 |
-
"/app/nova-ai-model"
|
| 131 |
-
]
|
| 132 |
-
|
| 133 |
-
model_path = None
|
| 134 |
-
for path in possible_paths:
|
| 135 |
-
if os.path.exists(path):
|
| 136 |
-
model_path = path
|
| 137 |
-
logger.info(f"Model found at: {path}")
|
| 138 |
-
break
|
| 139 |
-
|
| 140 |
-
if not model_path:
|
| 141 |
-
logger.warning("No model files found - running in demo mode")
|
| 142 |
-
return "🎭 Demo Mode: Model dosyaları bulunamadı, demo yanıtlar kullanılıyor"
|
| 143 |
-
|
| 144 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 145 |
-
|
| 146 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 147 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 148 |
-
model_path,
|
| 149 |
-
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
| 150 |
-
device_map="auto" if device == "cuda" else None,
|
| 151 |
-
trust_remote_code=True
|
| 152 |
-
)
|
| 153 |
-
|
| 154 |
-
logger.info(f"✅ Nova AI model loaded successfully on {device}")
|
| 155 |
-
return f"✅ Nova AI model hazır! ({device})"
|
| 156 |
-
|
| 157 |
-
except Exception as e:
|
| 158 |
-
logger.error(f"Model loading failed: {e}")
|
| 159 |
-
return f"🎭 Demo Mode: Model yüklenemedi, demo yanıtlar kullanılıyor"
|
| 160 |
-
|
| 161 |
-
def clear_chat():
|
| 162 |
-
"""Clear chat history"""
|
| 163 |
-
return []
|
| 164 |
-
|
| 165 |
-
# Model yükle (başlangıçta)
|
| 166 |
-
initial_status = load_model()
|
| 167 |
-
|
| 168 |
-
# 🎨 Gradio Interface
|
| 169 |
-
def create_interface():
|
| 170 |
-
"""
|
| 171 |
-
Nova AI Gradio interface
|
| 172 |
-
"""
|
| 173 |
-
|
| 174 |
-
with gr.Blocks(
|
| 175 |
-
theme=gr.themes.Soft(),
|
| 176 |
-
title="🚀 Teknova Nova AI",
|
| 177 |
-
css="""
|
| 178 |
-
.main-header {
|
| 179 |
-
text-align: center;
|
| 180 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 181 |
-
color: white;
|
| 182 |
-
padding: 2rem;
|
| 183 |
-
border-radius: 15px;
|
| 184 |
-
margin-bottom: 2rem;
|
| 185 |
-
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
| 186 |
-
}
|
| 187 |
-
.main-header h1 {
|
| 188 |
-
font-size: 2.5rem;
|
| 189 |
-
margin-bottom: 0.5rem;
|
| 190 |
-
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
| 191 |
-
}
|
| 192 |
-
.chat-container {
|
| 193 |
-
border-radius: 10px;
|
| 194 |
-
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
|
| 195 |
-
}
|
| 196 |
-
.control-panel {
|
| 197 |
-
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 198 |
-
padding: 1.5rem;
|
| 199 |
-
border-radius: 10px;
|
| 200 |
-
margin: 1rem 0;
|
| 201 |
-
}
|
| 202 |
-
.example-buttons {
|
| 203 |
-
margin: 1rem 0;
|
| 204 |
-
}
|
| 205 |
-
.footer {
|
| 206 |
-
text-align: center;
|
| 207 |
-
padding: 2rem;
|
| 208 |
-
background: #f8f9fa;
|
| 209 |
-
border-radius: 10px;
|
| 210 |
-
margin-top: 2rem;
|
| 211 |
-
border: 1px solid #e9ecef;
|
| 212 |
-
}
|
| 213 |
-
"""
|
| 214 |
-
) as demo:
|
| 215 |
-
|
| 216 |
-
# Header
|
| 217 |
-
gr.HTML("""
|
| 218 |
-
<div class="main-header">
|
| 219 |
-
<h1>🚀 Teknova Nova AI</h1>
|
| 220 |
-
<p style="font-size: 1.2rem; margin-bottom: 0.5rem;">Özgün Yapay Zeka Teknolojisi</p>
|
| 221 |
-
<p style="font-size: 1rem; opacity: 0.9;"><em>Powered by Teknova - Live on Hugging Face Spaces!</em></p>
|
| 222 |
-
</div>
|
| 223 |
-
""")
|
| 224 |
-
|
| 225 |
-
# Status
|
| 226 |
-
gr.Markdown(f"**🔧 Sistem Durumu:** {initial_status}")
|
| 227 |
-
|
| 228 |
-
# Main interface
|
| 229 |
-
with gr.Row():
|
| 230 |
-
with gr.Column(scale=3):
|
| 231 |
-
chatbot = gr.Chatbot(
|
| 232 |
-
label="💬 Nova AI Sohbet",
|
| 233 |
-
height=450,
|
| 234 |
-
show_label=True,
|
| 235 |
-
container=True,
|
| 236 |
-
elem_classes=["chat-container"],
|
| 237 |
-
avatar_images=("👤", "🤖")
|
| 238 |
-
)
|
| 239 |
-
|
| 240 |
-
with gr.Row():
|
| 241 |
-
msg = gr.Textbox(
|
| 242 |
-
label="✍️ Mesajınız",
|
| 243 |
-
placeholder="Nova AI'ye sorunuzu yazın... (Örn: 'Merhaba', 'Yapay zeka nedir?')",
|
| 244 |
-
lines=2,
|
| 245 |
-
scale=4,
|
| 246 |
-
show_label=False
|
| 247 |
-
)
|
| 248 |
-
send_btn = gr.Button("📤 Gönder", scale=1, variant="primary", size="lg")
|
| 249 |
-
|
| 250 |
-
clear_btn = gr.Button("🗑️ Sohbeti Temizle", variant="secondary", size="sm")
|
| 251 |
-
|
| 252 |
-
with gr.Column(scale=1):
|
| 253 |
-
with gr.Group():
|
| 254 |
-
gr.Markdown("### ⚙️ Ayarlar")
|
| 255 |
-
|
| 256 |
-
max_length = gr.Slider(
|
| 257 |
-
minimum=50,
|
| 258 |
-
maximum=500,
|
| 259 |
-
value=200,
|
| 260 |
-
step=25,
|
| 261 |
-
label="📏 Maksimum Uzunluk",
|
| 262 |
-
info="Yanıtın ne kadar uzun olacağını belirler"
|
| 263 |
-
)
|
| 264 |
-
|
| 265 |
-
temperature = gr.Slider(
|
| 266 |
-
minimum=0.1,
|
| 267 |
-
maximum=1.2,
|
| 268 |
-
value=0.7,
|
| 269 |
-
step=0.1,
|
| 270 |
-
label="🎨 Yaratıcılık (Temperature)",
|
| 271 |
-
info="Düşük: tutarlı, Yüksek: yaratıcı"
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
with gr.Group():
|
| 275 |
-
gr.Markdown("### 💡 Bilgi")
|
| 276 |
-
gr.Markdown("""
|
| 277 |
-
**Nova AI Özellikleri:**
|
| 278 |
-
- 🧠 Gelişmiş dil anlama
|
| 279 |
-
- 💬 Doğal konuşma
|
| 280 |
-
- 🌍 Türkçe optimizasyonu
|
| 281 |
-
- ⚡ Hızlı yanıt
|
| 282 |
-
""")
|
| 283 |
-
|
| 284 |
-
# Example questions
|
| 285 |
-
gr.Markdown("### 💬 Örnek Sorular")
|
| 286 |
-
with gr.Row(elem_classes=["example-buttons"]):
|
| 287 |
-
example_buttons = [
|
| 288 |
-
gr.Button("👋 Merhaba Nova AI!", size="sm", variant="secondary"),
|
| 289 |
-
gr.Button("🤖 Yapay zeka nedir?", size="sm", variant="secondary"),
|
| 290 |
-
gr.Button("🚀 Teknova hakkında bilgi", size="sm", variant="secondary"),
|
| 291 |
-
gr.Button("💡 Proje fikirleri öner", size="sm", variant="secondary")
|
| 292 |
-
]
|
| 293 |
-
|
| 294 |
-
# Event handlers
|
| 295 |
-
send_btn.click(
|
| 296 |
-
chat_response,
|
| 297 |
-
inputs=[msg, chatbot, max_length, temperature],
|
| 298 |
-
outputs=[msg, chatbot],
|
| 299 |
-
show_progress=True
|
| 300 |
-
)
|
| 301 |
-
|
| 302 |
-
msg.submit(
|
| 303 |
-
chat_response,
|
| 304 |
-
inputs=[msg, chatbot, max_length, temperature],
|
| 305 |
-
outputs=[msg, chatbot],
|
| 306 |
-
show_progress=True
|
| 307 |
-
)
|
| 308 |
-
|
| 309 |
-
clear_btn.click(clear_chat, outputs=chatbot)
|
| 310 |
-
|
| 311 |
-
# Example button handlers
|
| 312 |
-
example_buttons[0].click(lambda: "Merhaba Nova AI!", outputs=msg)
|
| 313 |
-
example_buttons[1].click(lambda: "Yapay zeka nedir?", outputs=msg)
|
| 314 |
-
example_buttons[2].click(lambda: "Teknova hakkında bilgi ver", outputs=msg)
|
| 315 |
-
example_buttons[3].click(lambda: "Bana yenilikçi proje fikirleri öner", outputs=msg)
|
| 316 |
-
|
| 317 |
-
# Footer
|
| 318 |
-
gr.HTML("""
|
| 319 |
-
<div class="footer">
|
| 320 |
-
<h3>🚀 Teknova Nova AI</h3>
|
| 321 |
-
<p><strong>Özgün yapay zeka teknolojisi</strong></p>
|
| 322 |
-
<p>
|
| 323 |
-
<a href="https://github.com/veteroner/novaai" target="_blank" style="margin: 0 10px;">📂 GitHub</a> |
|
| 324 |
-
<a href="https://huggingface.co/spaces/veteroner/NovaAI" target="_blank" style="margin: 0 10px;">🤗 HF Spaces</a> |
|
| 325 |
-
<a href="mailto:teknova@example.com" style="margin: 0 10px;">📧 İletişim</a>
|
| 326 |
-
</p>
|
| 327 |
-
<p style="margin-top: 1rem; font-size: 0.9rem; color: #666;">
|
| 328 |
-
<em>Made with ❤️ by Teknova | Powered by Hugging Face Spaces</em>
|
| 329 |
-
</p>
|
| 330 |
-
</div>
|
| 331 |
-
""")
|
| 332 |
-
|
| 333 |
-
return demo
|
| 334 |
-
|
| 335 |
-
# Create and launch
|
| 336 |
-
if __name__ == "__main__":
|
| 337 |
-
demo = create_interface()
|
| 338 |
-
demo.queue(max_size=20, default_concurrency_limit=5)
|
| 339 |
-
demo.launch(
|
| 340 |
-
server_name="0.0.0.0",
|
| 341 |
-
server_port=7860,
|
| 342 |
-
share=False,
|
| 343 |
-
show_error=True,
|
| 344 |
-
debug=False
|
| 345 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hf_requirements.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
gradio==4.11.0
|
| 2 |
-
torch>=1.13.0
|
| 3 |
-
transformers>=4.25.0
|
| 4 |
-
accelerate>=0.20.0
|
| 5 |
-
sentencepiece>=0.1.97
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hf_space_app.py
CHANGED
|
@@ -20,8 +20,8 @@ except ImportError:
|
|
| 20 |
return func
|
| 21 |
spaces = type('spaces', (), {'GPU': spaces_gpu})()
|
| 22 |
|
| 23 |
-
# Model seçenekleri -
|
| 24 |
-
MODEL_PATH = "
|
| 25 |
|
| 26 |
# Global değişkenler
|
| 27 |
model = None
|
|
|
|
| 20 |
return func
|
| 21 |
spaces = type('spaces', (), {'GPU': spaces_gpu})()
|
| 22 |
|
| 23 |
+
# Model seçenekleri - Local model kullan
|
| 24 |
+
MODEL_PATH = "nova-ai-model" # Local model path
|
| 25 |
|
| 26 |
# Global değişkenler
|
| 27 |
model = None
|
nova-ai-small/README.md
DELETED
|
@@ -1,243 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Teknova Nova AI
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: transformers
|
| 7 |
-
license: apache-2.0
|
| 8 |
-
language:
|
| 9 |
-
- tr
|
| 10 |
-
- en
|
| 11 |
-
tags:
|
| 12 |
-
- text-generation
|
| 13 |
-
- conversational
|
| 14 |
-
- turkish
|
| 15 |
-
- teknova
|
| 16 |
-
- nova-ai
|
| 17 |
-
- chat
|
| 18 |
-
- assistant
|
| 19 |
-
pipeline_tag: text-generation
|
| 20 |
-
library_name: transformers
|
| 21 |
-
---
|
| 22 |
-
|
| 23 |
-
# 🚀 Teknova Nova AI
|
| 24 |
-
|
| 25 |
-
**Türkiye'nin Özgün Yapay Zeka Modeli**
|
| 26 |
-
|
| 27 |
-
Teknova Nova AI, Türkçe konuşma ve anlama konusunda optimize edilmiş, tamamen özgün bir dil modelidir. Mistral-7B mimarisi üzerine inşa edilmiş ancak Teknova tarafından özel olarak fine-tune edilmiştir.
|
| 28 |
-
|
| 29 |
-
---
|
| 30 |
-
|
| 31 |
-
## 🌟 **Model Özellikleri**
|
| 32 |
-
|
| 33 |
-
### ✨ **Özgün Teknova Teknolojisi**
|
| 34 |
-
- 🧠 **Türkçe Optimizasyonu** - Türkçe dil yapısına özel eğitim
|
| 35 |
-
- 💬 **Doğal Konuşma** - İnsan benzeri etkileşim yetenekleri
|
| 36 |
-
- 🎯 **Bağlamsal Anlama** - Gelişmiş anlam çıkarma
|
| 37 |
-
- ⚡ **Hızlı Yanıt** - Optimize edilmiş performans
|
| 38 |
-
- 🔧 **Çok Amaçlı** - Sohbet, yazma, analiz yetenekleri
|
| 39 |
-
|
| 40 |
-
### 🛠️ **Teknik Detaylar**
|
| 41 |
-
- **Temel Model:** Mistral-7B mimarisi
|
| 42 |
-
- **Parametre Sayısı:** 7.24 milyar
|
| 43 |
-
- **Eğitim Dili:** Türkçe + İngilizce
|
| 44 |
-
- **Bağlam Uzunluğu:** 8192 token
|
| 45 |
-
- **Model Formatı:** SafeTensors + PyTorch
|
| 46 |
-
|
| 47 |
-
---
|
| 48 |
-
|
| 49 |
-
## 🚀 **Kullanım**
|
| 50 |
-
|
| 51 |
-
### 💻 **Transformers ile**
|
| 52 |
-
```python
|
| 53 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
-
import torch
|
| 55 |
-
|
| 56 |
-
# Nova AI modelini yükle
|
| 57 |
-
model_name = "Teknova/NovaAI"
|
| 58 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 59 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
-
model_name,
|
| 61 |
-
torch_dtype=torch.float16,
|
| 62 |
-
device_map="auto"
|
| 63 |
-
)
|
| 64 |
-
|
| 65 |
-
# Sohbet örneği
|
| 66 |
-
def chat_with_nova(message):
|
| 67 |
-
conversation = f"Kullanıcı: {message}\nNova AI:"
|
| 68 |
-
inputs = tokenizer(conversation, return_tensors="pt")
|
| 69 |
-
|
| 70 |
-
with torch.no_grad():
|
| 71 |
-
outputs = model.generate(
|
| 72 |
-
**inputs,
|
| 73 |
-
max_new_tokens=512,
|
| 74 |
-
temperature=0.7,
|
| 75 |
-
top_p=0.9,
|
| 76 |
-
do_sample=True,
|
| 77 |
-
pad_token_id=tokenizer.eos_token_id
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 81 |
-
return response[len(conversation):].strip()
|
| 82 |
-
|
| 83 |
-
# Örnek kullanım
|
| 84 |
-
response = chat_with_nova("Merhaba Nova AI, nasılsın?")
|
| 85 |
-
print(response)
|
| 86 |
-
```
|
| 87 |
-
|
| 88 |
-
### 🌐 **API ile Kullanım**
|
| 89 |
-
```python
|
| 90 |
-
import requests
|
| 91 |
-
|
| 92 |
-
API_URL = "https://api-inference.huggingface.co/models/Teknova/NovaAI"
|
| 93 |
-
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
|
| 94 |
-
|
| 95 |
-
def query_nova_ai(payload):
|
| 96 |
-
response = requests.post(API_URL, headers=headers, json=payload)
|
| 97 |
-
return response.json()
|
| 98 |
-
|
| 99 |
-
# Örnek sorgu
|
| 100 |
-
output = query_nova_ai({
|
| 101 |
-
"inputs": "Yapay zeka teknolojileri hakkında bilgi ver",
|
| 102 |
-
"parameters": {
|
| 103 |
-
"max_new_tokens": 256,
|
| 104 |
-
"temperature": 0.7,
|
| 105 |
-
"top_p": 0.9
|
| 106 |
-
}
|
| 107 |
-
})
|
| 108 |
-
print(output)
|
| 109 |
-
```
|
| 110 |
-
|
| 111 |
-
---
|
| 112 |
-
|
| 113 |
-
## 💡 **Örnek Kullanım Alanları**
|
| 114 |
-
|
| 115 |
-
### 🎯 **Sohbet ve Asistan**
|
| 116 |
-
- Müşteri hizmetleri chatbotu
|
| 117 |
-
- Kişisel asistan uygulamaları
|
| 118 |
-
- Eğitim ve öğretim desteği
|
| 119 |
-
|
| 120 |
-
### 📝 **İçerik Üretimi**
|
| 121 |
-
- Blog yazısı ve makale yazımı
|
| 122 |
-
- Sosyal medya içeriği
|
| 123 |
-
- Yaratıcı yazım desteği
|
| 124 |
-
|
| 125 |
-
### 🔍 **Analiz ve Özetleme**
|
| 126 |
-
- Metin analizi ve özetleme
|
| 127 |
-
- Duygu analizi
|
| 128 |
-
- Bilgi çıkarma
|
| 129 |
-
|
| 130 |
-
---
|
| 131 |
-
|
| 132 |
-
## ⚙️ **Model Parametreleri**
|
| 133 |
-
|
| 134 |
-
| Parametre | Değer | Açıklama |
|
| 135 |
-
|-----------|-------|----------|
|
| 136 |
-
| `temperature` | 0.7 | Yaratıcılık seviyesi (0.1-1.5) |
|
| 137 |
-
| `top_p` | 0.9 | Nucleus sampling |
|
| 138 |
-
| `max_new_tokens` | 512 | Maksimum yanıt uzunluğu |
|
| 139 |
-
| `repetition_penalty` | 1.1 | Tekrar önleme |
|
| 140 |
-
|
| 141 |
-
---
|
| 142 |
-
|
| 143 |
-
## 🎨 **Demo ve Uygulamalar**
|
| 144 |
-
|
| 145 |
-
### 🌐 **Web Arayüzü**
|
| 146 |
-
- **Gradio Demo:** [Nova AI Chat](https://huggingface.co/spaces/Teknova/NovaAI-Chat)
|
| 147 |
-
- **HTML Arayüz:** Kendi web sitenizde kullanabilirsiniz
|
| 148 |
-
|
| 149 |
-
### 📱 **Entegrasyon**
|
| 150 |
-
```javascript
|
| 151 |
-
// Web sitesinde kullanım örneği
|
| 152 |
-
const API_URL = 'https://api-inference.huggingface.co/models/Teknova/NovaAI';
|
| 153 |
-
|
| 154 |
-
async function queryNovaAI(text) {
|
| 155 |
-
const response = await fetch(API_URL, {
|
| 156 |
-
headers: {
|
| 157 |
-
'Authorization': 'Bearer YOUR_TOKEN',
|
| 158 |
-
'Content-Type': 'application/json'
|
| 159 |
-
},
|
| 160 |
-
method: 'POST',
|
| 161 |
-
body: JSON.stringify({
|
| 162 |
-
inputs: text,
|
| 163 |
-
parameters: {
|
| 164 |
-
max_new_tokens: 256,
|
| 165 |
-
temperature: 0.7
|
| 166 |
-
}
|
| 167 |
-
})
|
| 168 |
-
});
|
| 169 |
-
|
| 170 |
-
return await response.json();
|
| 171 |
-
}
|
| 172 |
-
```
|
| 173 |
-
|
| 174 |
-
---
|
| 175 |
-
|
| 176 |
-
## 📊 **Performans**
|
| 177 |
-
|
| 178 |
-
### 🚀 **Hız ve Verimlilik**
|
| 179 |
-
- **CPU Modunda:** ~2-3 saniye yanıt süresi
|
| 180 |
-
- **GPU Modunda:** ~0.5-1 saniye yanıt süresi
|
| 181 |
-
- **Bellek Kullanımı:** ~14.5GB model boyutu
|
| 182 |
-
- **Optimizasyon:** 4-bit quantization desteği
|
| 183 |
-
|
| 184 |
-
### 🎯 **Kalite Metrikleri**
|
| 185 |
-
- **Türkçe Doğruluk:** Yüksek seviyede Türkçe anlama
|
| 186 |
-
- **Bağlamsal Tutarlılık:** Uzun konuşmalarda tutarlı yanıtlar
|
| 187 |
-
- **Yaratıcılık:** Özgün ve çeşitli içerik üretimi
|
| 188 |
-
|
| 189 |
-
---
|
| 190 |
-
|
| 191 |
-
## 🔧 **Sistem Gereksinimleri**
|
| 192 |
-
|
| 193 |
-
### 💻 **Minimum Gereksinimler**
|
| 194 |
-
- **RAM:** 16GB (4-bit quantization ile)
|
| 195 |
-
- **GPU:** 8GB VRAM (RTX 3070 veya üzeri)
|
| 196 |
-
- **CPU:** 4 çekirdek, 2.5GHz+
|
| 197 |
-
- **Depolama:** 20GB boş alan
|
| 198 |
-
|
| 199 |
-
### 🚀 **Önerilen Gereksinimler**
|
| 200 |
-
- **RAM:** 32GB
|
| 201 |
-
- **GPU:** 16GB+ VRAM (RTX 4080/4090)
|
| 202 |
-
- **CPU:** 8+ çekirdek, 3.0GHz+
|
| 203 |
-
- **Depolama:** SSD, 50GB+ boş alan
|
| 204 |
-
|
| 205 |
-
---
|
| 206 |
-
|
| 207 |
-
## 📜 **Lisans ve Kullanım**
|
| 208 |
-
|
| 209 |
-
Bu model **Apache 2.0** lisansı altında yayınlanmıştır. Ticari ve akademik kullanım için serbesttir.
|
| 210 |
-
|
| 211 |
-
### ⚠️ **Önemli Notlar**
|
| 212 |
-
- Model özgün Teknova teknolojisi içermektedir
|
| 213 |
-
- Türkçe optimizasyonları Teknova tarafından geliştirilmiştir
|
| 214 |
-
- Responsible AI ilkelerine uygun olarak kullanılmalıdır
|
| 215 |
-
|
| 216 |
-
---
|
| 217 |
-
|
| 218 |
-
## 🏢 **Teknova Hakkında**
|
| 219 |
-
|
| 220 |
-
**Teknova**, Türkiye'nin öncü yapay zeka teknoloji şirketidir. Özgün AI çözümleri geliştirerek teknoloji dünyasında fark yaratmayı hedefliyoruz.
|
| 221 |
-
|
| 222 |
-
### 🎯 **Misyonumuz**
|
| 223 |
-
Yapay zeka teknolojilerini Türkçe konuşan kullanıcılar için optimize etmek ve erişilebilir kılmak.
|
| 224 |
-
|
| 225 |
-
### 🚀 **Vizyonumuz**
|
| 226 |
-
Türkiye'den dünyaya özgün yapay zeka teknolojileri ihraç etmek.
|
| 227 |
-
|
| 228 |
-
---
|
| 229 |
-
|
| 230 |
-
## 📞 **İletişim ve Destek**
|
| 231 |
-
|
| 232 |
-
- **🌐 Website:** [teknova.ai](https://teknova.ai)
|
| 233 |
-
- **📧 E-posta:** info@teknova.ai
|
| 234 |
-
- **💬 Destek:** [GitHub Issues](https://github.com/teknova-ai/nova-ai/issues)
|
| 235 |
-
- **📱 Sosyal Medya:** [@TeknovaAI](https://twitter.com/TeknovaAI)
|
| 236 |
-
|
| 237 |
-
---
|
| 238 |
-
|
| 239 |
-
## 🙏 **Teşekkürler**
|
| 240 |
-
|
| 241 |
-
Nova AI'yi kullandığınız için teşekkürler! Geri bildirimleriniz bizim için değerlidir.
|
| 242 |
-
|
| 243 |
-
**Teknova Nova AI** - *Türkiye'nin Özgün Yapay Zeka Teknolojisi* 🚀
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements-dev.txt
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
# 🧪 Testing
|
| 2 |
-
pytest>=7.0.0
|
| 3 |
-
pytest-cov>=4.0.0
|
| 4 |
-
pytest-mock>=3.10.0
|
| 5 |
-
pytest-asyncio>=0.21.0
|
| 6 |
-
|
| 7 |
-
# 🎨 Code Formatting
|
| 8 |
-
black>=23.0.0
|
| 9 |
-
isort>=5.12.0
|
| 10 |
-
|
| 11 |
-
# 🔍 Linting
|
| 12 |
-
flake8>=6.0.0
|
| 13 |
-
pylint>=2.17.0
|
| 14 |
-
mypy>=1.3.0
|
| 15 |
-
|
| 16 |
-
# 🔒 Security
|
| 17 |
-
bandit>=1.7.5
|
| 18 |
-
safety>=2.3.0
|
| 19 |
-
|
| 20 |
-
# 📊 Performance
|
| 21 |
-
memory-profiler>=0.60.0
|
| 22 |
-
line-profiler>=4.0.0
|
| 23 |
-
|
| 24 |
-
# 📚 Documentation
|
| 25 |
-
sphinx>=6.2.0
|
| 26 |
-
sphinx-rtd-theme>=1.2.0
|
| 27 |
-
|
| 28 |
-
# 🔧 Development Tools
|
| 29 |
-
pre-commit>=3.3.0
|
| 30 |
-
commitizen>=3.2.0
|
| 31 |
-
bumpversion>=0.6.0
|
| 32 |
-
|
| 33 |
-
# 🐳 Docker
|
| 34 |
-
docker>=6.1.0
|
| 35 |
-
|
| 36 |
-
# 📦 Build
|
| 37 |
-
build>=0.10.0
|
| 38 |
-
wheel>=0.40.0
|
| 39 |
-
twine>=4.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
token_kurulum.bat
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
@echo off
|
| 2 |
-
chcp 65001 >nul
|
| 3 |
-
echo.
|
| 4 |
-
echo 🚀 ========================
|
| 5 |
-
echo Nova AI Token Kurulumu
|
| 6 |
-
echo by Teknova
|
| 7 |
-
echo ========================
|
| 8 |
-
echo.
|
| 9 |
-
|
| 10 |
-
echo 📝 Hugging Face Token alma adımları:
|
| 11 |
-
echo.
|
| 12 |
-
echo 1️⃣ Tarayıcınızda şu adresi açın:
|
| 13 |
-
echo 👉 https://huggingface.co/settings/tokens
|
| 14 |
-
echo.
|
| 15 |
-
echo 2️⃣ "New token" butonuna tıklayın
|
| 16 |
-
echo.
|
| 17 |
-
echo 3️⃣ Token bilgilerini doldurun:
|
| 18 |
-
echo 📛 Name: NovaAI-Token
|
| 19 |
-
echo 🔑 Role: Read
|
| 20 |
-
echo.
|
| 21 |
-
echo 4️⃣ "Generate a token" tıklayın
|
| 22 |
-
echo.
|
| 23 |
-
echo 5️⃣ Token'ı kopyalayın (hf_xxx... ile başlar)
|
| 24 |
-
echo.
|
| 25 |
-
echo 🔧 Token'ı nasıl kullanacağınız:
|
| 26 |
-
echo.
|
| 27 |
-
echo 💻 Seçenek 1 - Environment Variable:
|
| 28 |
-
echo set HF_TOKEN=hf_xxxxxxxxxxxxxxxxxx
|
| 29 |
-
echo.
|
| 30 |
-
echo 📝 Seçenek 2 - Kod içinde:
|
| 31 |
-
echo gradio_app.py dosyasındaki ilgili satırı düzenleyin
|
| 32 |
-
echo.
|
| 33 |
-
echo ⚡ EN KOLAY: Yerel model kullanın (token gerekmez!)
|
| 34 |
-
echo ✅ Tüm dosyalar zaten düzenlendi
|
| 35 |
-
echo.
|
| 36 |
-
echo 🚀 Nova AI başlatmak için:
|
| 37 |
-
echo 👉 baslat_api.bat (Web arayüzü)
|
| 38 |
-
echo 👉 baslat_konsol.bat (Konsol)
|
| 39 |
-
echo.
|
| 40 |
-
echo 💡 Teknova ile güçlendirilmiştir
|
| 41 |
-
echo.
|
| 42 |
-
pause
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|