Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
|
|
|
|
|
4 |
|
5 |
-
#
|
6 |
-
|
7 |
-
alp_prompt = requests.get(alp_prompt_url).text.strip()
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
return response
|
23 |
|
24 |
-
|
25 |
-
gr.Interface(fn=chat,
|
26 |
-
inputs=gr.Textbox(label="Mesajını yaz, AlpDroid cevaplasın"),
|
27 |
-
outputs=gr.Textbox(label="AlpDroid"),
|
28 |
-
title="🧠 AlpDroid (Falcon 7B)",
|
29 |
-
description="AlpDroid şu anda Falcon 7B ile çalışıyor. Özgür, eğlenceli ve asi.").launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Model seçimi (hafif, hızlı)
|
5 |
+
model_name = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF"
|
6 |
|
7 |
+
# Pipeline ile sohbet modeli açıyoruz
|
8 |
+
chat = pipeline("text-generation", model=model_name, device=0, trust_remote_code=True)
|
|
|
9 |
|
10 |
+
# AlpDroid promptunu çekiyoruz (Raw link)
|
11 |
+
import requests
|
12 |
+
prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/main/prompt.txt"
|
13 |
+
system_prompt = requests.get(prompt_url).text
|
14 |
|
15 |
+
def alp_droid_chat(user_input):
|
16 |
+
full_prompt = system_prompt + "\n\nKullanıcı: " + user_input + "\nAlpDroid:"
|
17 |
+
response = chat(full_prompt, max_length=512, do_sample=True, temperature=0.7)
|
18 |
+
return response[0]['generated_text'].split("AlpDroid:")[-1].strip()
|
19 |
|
20 |
+
iface = gr.Interface(fn=alp_droid_chat,
|
21 |
+
inputs=gr.Textbox(lines=5, placeholder="Sorunu yaz..."),
|
22 |
+
outputs="text",
|
23 |
+
title="AlpDroid AI Chat",
|
24 |
+
description="Mistral tabanlı AlpDroid promptuyla çalışan yapay zeka.")
|
|
|
25 |
|
26 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|