Spaces:
Sleeping
Sleeping
| import requests | |
| import gradio as gr | |
| # ماڈلز کی لسٹ | |
| MODELS = { | |
| "Qwen Coder": "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-7B-Instruct", | |
| "DeepSeek Coder": "https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-Coder-6.7B-Instruct", | |
| "Phind Expert": "https://api-inference.huggingface.co/models/phind/Phind-CodeLlama-34B-v2" | |
| } | |
| def check_token_status(provided_key): | |
| # ✅ پہلے GMD Key چیک کریں | |
| if provided_key != GMD_ULTRA_KEY: | |
| return "❌ Unauthorized: Invalid GMD Key provided." | |
| results = [] | |
| for name, url in MODELS.items(): | |
| try: | |
| response = requests.post( | |
| url, | |
| headers={ | |
| "Authorization": f"Bearer {HF_TOKEN}", | |
| "Content-Type": "application/json" | |
| }, | |
| json={"inputs": "Hi", "parameters": {"max_new_tokens": 10}} | |
| ) | |
| if response.status_code == 200: | |
| results.append(f"✅ {name}: WORKING") | |
| else: | |
| results.append(f"❌ {name}: Error {response.status_code}") | |
| except Exception as e: | |
| results.append(f"❌ {name}: Failed - {str(e)}") | |
| return "\n".join(results) | |
| # Gradio Interface | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# GMD SPARK AI Token Tester") | |
| # ایک ان پٹ باکس جہاں صارف اپنی GMD Key درج کرے گا | |
| key_input = gr.Textbox(label="Enter Your GMD Ultra Key", placeholder="Paste your key here...") | |
| btn = gr.Button("Check Token Status") | |
| output = gr.Textbox(label="Results") | |
| # جب بٹن دبایا جائے تو فنکشن کال ہو | |
| btn.click(check_token_status, inputs=key_input, outputs=output) | |
| demo.launch() |