Upload 2 files
Browse files- app.py +21 -0
- requirements.txt.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Modeli yükle
|
| 5 |
+
pipe = pipeline("text-generation", model="Zenkad/zenkaMind-1.1B", device_map="auto")
|
| 6 |
+
|
| 7 |
+
def sohbet(message, history):
|
| 8 |
+
prompt = f"<|system|>\nSen ZenkaMind'sin. Türk genci gibi konuş.</s>\n<|user|>\n{message}</s>\n<|assistant|>\n"
|
| 9 |
+
result = pipe(prompt, max_new_tokens=60, temperature=0.9)[0]["generated_text"]
|
| 10 |
+
cevap = result.split("<|assistant|>\n")[-1].strip()
|
| 11 |
+
history.append([message, cevap])
|
| 12 |
+
return history, ""
|
| 13 |
+
|
| 14 |
+
# Arayüz
|
| 15 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 16 |
+
gr.Markdown("# zenkaMind 1.1B\n**senin gibi konuşur, 1 saniyede cevap verir!**")
|
| 17 |
+
chatbot = gr.Chatbot(height=500)
|
| 18 |
+
msg = gr.Textbox(placeholder="selam canımm...", label="Sen:")
|
| 19 |
+
msg.submit(sohbet, [msg, chatbot], [chatbot, msg])
|
| 20 |
+
|
| 21 |
+
demo.launch()
|
requirements.txt.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
accelerate
|