MySafeCode commited on
Commit
ce9cdc9
·
verified ·
1 Parent(s): 74af09c

Create deb.py

Browse files
Files changed (1) hide show
  1. deb.py +25 -0
deb.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import os
4
+
5
+ # Your API key from Hugging Face secret "key"
6
+ API_KEY = os.environ.get("key", "")
7
+
8
+ def test_connection():
9
+ """Test each part separately"""
10
+ results = []
11
+
12
+ # Test 1: Is API key loaded?
13
+ results.append(f"Step 1 - API Key loaded: {'✅' if API_KEY else '❌'}")
14
+ if API_KEY:
15
+ results.append(f" Length: {len(API_KEY)}")
16
+ results.append(f" First 4 chars: {API_KEY[:4]}")
17
+
18
+ # Test 2: Can we reach the API?
19
+ url = "https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks"
20
+ headers = {
21
+ "Content-Type": "application/json",
22
+ "Authorization": f"Bearer {API_KEY}"
23
+ }
24
+
25
+ # Minimal test data