File size: 1,044 Bytes
4639901
db534bd
 
 
 
1dbcaa4
db534bd
 
1dbcaa4
db534bd
 
 
 
1dbcaa4
db534bd
 
 
 
1dbcaa4
db534bd
 
 
 
 
1dbcaa4
db534bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from transformers import pipeline

# Model seçimi (hafif, hızlı)
model_name = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF"

# Pipeline ile sohbet modeli açıyoruz
chat = pipeline("text-generation", model=model_name, device=0, trust_remote_code=True)

# AlpDroid promptunu çekiyoruz (Raw link)
import requests
prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/main/prompt.txt"
system_prompt = requests.get(prompt_url).text

def alp_droid_chat(user_input):
    full_prompt = system_prompt + "\n\nKullanıcı: " + user_input + "\nAlpDroid:"
    response = chat(full_prompt, max_length=512, do_sample=True, temperature=0.7)
    return response[0]['generated_text'].split("AlpDroid:")[-1].strip()

iface = gr.Interface(fn=alp_droid_chat, 
                     inputs=gr.Textbox(lines=5, placeholder="Sorunu yaz..."),
                     outputs="text",
                     title="AlpDroid AI Chat",
                     description="Mistral tabanlı AlpDroid promptuyla çalışan yapay zeka.")

iface.launch()