Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, TextGenerationPipe
|
|
6 |
alp_prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/main/prompt.txt"
|
7 |
alp_prompt = requests.get(alp_prompt_url).text.strip()
|
8 |
|
9 |
-
#
|
10 |
-
model_id = "
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
12 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype="auto")
|
13 |
|
@@ -18,7 +18,6 @@ pipeline = TextGenerationPipeline(model=model, tokenizer=tokenizer)
|
|
18 |
def chat(prompt):
|
19 |
full_prompt = f"{alp_prompt}\n\nKullanıcı: {prompt}\nAlpDroid:"
|
20 |
result = pipeline(full_prompt, max_new_tokens=200, temperature=0.8, top_p=0.9)[0]["generated_text"]
|
21 |
-
# Sadece cevabı almak için promptu ayıkla
|
22 |
response = result.split("AlpDroid:")[-1].strip()
|
23 |
return response
|
24 |
|
@@ -26,5 +25,5 @@ def chat(prompt):
|
|
26 |
gr.Interface(fn=chat,
|
27 |
inputs=gr.Textbox(label="Mesajını yaz, AlpDroid cevaplasın"),
|
28 |
outputs=gr.Textbox(label="AlpDroid"),
|
29 |
-
title="🧠 AlpDroid (
|
30 |
-
description="
|
|
|
6 |
alp_prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/main/prompt.txt"
|
7 |
alp_prompt = requests.get(alp_prompt_url).text.strip()
|
8 |
|
9 |
+
# Yeni model (tamamen açık kaynak)
|
10 |
+
model_id = "tiiuae/falcon-7b-instruct"
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
12 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype="auto")
|
13 |
|
|
|
18 |
def chat(prompt):
|
19 |
full_prompt = f"{alp_prompt}\n\nKullanıcı: {prompt}\nAlpDroid:"
|
20 |
result = pipeline(full_prompt, max_new_tokens=200, temperature=0.8, top_p=0.9)[0]["generated_text"]
|
|
|
21 |
response = result.split("AlpDroid:")[-1].strip()
|
22 |
return response
|
23 |
|
|
|
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()
|