Download app.py from abqari365/README: direct link, hf CLI and curl.
- Browser
- Download file 3.04 kB
-
https://huggingface.co/spaces/abqari365/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/abqari365/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/abqari365/README/resolve/main/app.py
3.04 kB
| import gradio as gr | |
| import requests | |
| import json | |
| # ✅ جميع النماذج القوية والمجانية | |
| MODELS = [ | |
| {"name": "DeepSeek V3", "url": "https://free.churchless.tech/v1/chat/completions", "model": "deepseek-chat"}, | |
| {"name": "DeepSeek R1", "url": "https://api.pawan.krd/v1/chat/completions", "model": "deepseek-r1"}, | |
| {"name": "DeepSeek Coder", "url": "https://free.gpt.ge/v1/chat/completions", "model": "deepseek-coder"}, | |
| {"name": "DeepSeek Logic", "url": "https://free.churchless.tech/v1/chat/completions", "model": "deepseek-llm-67b-chat"}, | |
| {"name": "Gemini 1.5 Flash", "url": "https://openrouter.ai/api/v1/chat/completions", "model": "google/gemini-flash-1.5"}, | |
| {"name": "Gemini 1.5 Pro", "url": "https://openrouter.ai/api/v1/chat/completions", "model": "google/gemini-pro-1.5"}, | |
| {"name": "Claude 3 Haiku", "url": "https://openrouter.ai/api/v1/chat/completions", "model": "anthropic/claude-3-haiku"}, | |
| {"name": "Claude 3 Sonnet", "url": "https://openrouter.ai/api/v1/chat/completions", "model": "anthropic/claude-3-sonnet"}, | |
| {"name": "Llama 3.3 70B", "url": "https://api.pawan.krd/v1/chat/completions", "model": "llama-3.3-70b"}, | |
| {"name": "Mistral 8x22B", "url": "https://free.churchless.tech/v1/chat/completions", "model": "mistralai/Mistral-8x22B-Instruct-v0.1"}, | |
| {"name": "Qwen 2 72B", "url": "https://free.gpt.ge/v1/chat/completions", "model": "qwen-2-72b-instruct"} | |
| ] | |
| SYSTEM = """أنت عبقري، مساعد ذكي عربي شامل. أجب بوضوح، دقة، منطق، وبأسلوب سلس ومفهوم.""" | |
| def chat(message, history): | |
| headers = {"Content-Type": "application/json"} | |
| payload = { | |
| "model": "", | |
| "messages": [{"role": "system", "content": SYSTEM}, {"role": "user", "content": message}], | |
| "temperature": 0.75, | |
| "max_tokens": 1200 | |
| } | |
| for m in MODELS: | |
| try: | |
| payload["model"] = m["model"] | |
| res = requests.post(m["url"], headers=headers, data=json.dumps(payload), timeout=30) | |
| if res.status_code == 200: | |
| data = res.json() | |
| return f"🤖 {m['name']}:\n\n{data['choices'][0]['message']['content'].strip()}" | |
| except: | |
| continue | |
| return "⚠️ جميع المصادر مشغولة، جرب بعد دقيقة." | |
| demo = gr.ChatInterface( | |
| fn=chat, | |
| title="🤖 عبقري - النظام الشامل", | |
| description="يعمل بأقوى 11 نموذج مجاني: ديب سيك • جيميني • كلاود • لاما • ميكسترال • كيوين", | |
| theme=gr.themes.Soft(primary_hue="blue"), | |
| chatbot=gr.Chatbot(height=600, rtl=True), | |
| textbox=gr.Textbox(placeholder="اكتب سؤالك هنا...", rtl=True), | |
| submit_btn="إرسال", clear_btn="مسح", retry_btn="إعادة المحاولة" | |
| ) | |
| # ✅ الإصلاح الأهم: إضافة share=True و server_name | |
| if __name__ == "__main__": | |
| demo.launch( | |
| server_name="0.0.0.0", | |
| share=True, | |
| show_api=False | |
| ) | |