Spaces:
Sleeping
Sleeping
File size: 1,356 Bytes
dc80b9f 74ff460 b81355a dc80b9f 74ff460 dc80b9f f00d9af dc80b9f 74ff460 dc80b9f ecebbca dc80b9f ecebbca dc80b9f ecebbca dc80b9f |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import gradio as gr
import requests
# AlpDroid prompt'unu GitHub'dan çek
alp_droid_prompt = requests.get(
"https://raw.githubusercontent.com/ALPERALL/AlpDroid/main/prompt.txt"
).text
# API ayarları
API_KEY = "fw_3ZHAHBUKKgDkDYqkM3MTGaf6"
MODEL = "accounts/fireworks/models/qwen2-7b-instruct"
# Fireworks AI üzerinden AlpDroid çağrısı
def ask_alpdroid(user_input):
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"model": MODEL,
"messages": [
{"role": "system", "content": alp_droid_prompt},
{"role": "user", "content": user_input}
],
"temperature": 0.7,
"max_tokens": 1024
}
response = requests.post(
"https://api.fireworks.ai/inference/v1/chat/completions",
json=data,
headers=headers
)
# JSON'dan yanıtı çek
try:
return response.json()["choices"][0]["message"]["content"]
except Exception as e:
return f"Hata: {e}\n\nDetay: {response.text}"
# Gradio arayüzü (minimal)
gr.Interface(
fn=ask_alpdroid,
inputs=gr.Textbox(label="Senin mesajın", placeholder="AlpDroid'e ne sormak istersin?", lines=6),
outputs=gr.Textbox(label="AlpDroid cevabı", lines=8),
title="🧠 AlpDroid x Qwen2.5 (Prompt Enjekte)"
).launch() |