Spaces:
Sleeping
Sleeping
| 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() |