Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,28 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
# Prompt
|
| 5 |
prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/refs/heads/main/prompt.txt"
|
| 6 |
-
|
| 7 |
|
| 8 |
-
# Modeli yükle
|
| 9 |
model = gr.load(
|
| 10 |
-
|
| 11 |
-
|
| 12 |
)
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
def
|
| 16 |
-
|
| 17 |
-
return model(
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
fn=chat_with_prompt,
|
| 22 |
-
inputs=gr.Textbox(label="Mesajını yaz"),
|
| 23 |
-
outputs="text",
|
| 24 |
-
title="AlpDroid v1",
|
| 25 |
-
description="ALPER tarafından eğitilmiş özel modlu ERNIE 4.5"
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
# Prompt dosyasını al
|
| 5 |
prompt_url = "https://raw.githubusercontent.com/ALPERALL/AlpDroid/refs/heads/main/prompt.txt"
|
| 6 |
+
alp_prompt = requests.get(prompt_url).text
|
| 7 |
|
| 8 |
+
# Modeli yükle (dokunmadık)
|
| 9 |
model = gr.load(
|
| 10 |
+
"models/baidu/ERNIE-4.5-21B-A3B-PT",
|
| 11 |
+
provider="novita",
|
| 12 |
)
|
| 13 |
|
| 14 |
+
# Prompt'u inputla birleştirip modele gönder
|
| 15 |
+
def wrapped_input(user_input):
|
| 16 |
+
full_prompt = f"{alp_prompt.strip()}\n\nKullanıcı: {user_input}"
|
| 17 |
+
return model(full_prompt)
|
| 18 |
|
| 19 |
+
# Arayüzü başlat
|
| 20 |
+
gr.Interface(fn=wrapped_input, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|