Machlovi commited on
Commit
f4bc135
·
verified ·
1 Parent(s): d03b0e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import requests
3
  import os
 
4
 
5
  # Configure the endpoint and authentication
6
  ENDPOINT_URL = os.environ.get("ENDPOINT_URL", "https://dz0eq6vxq3nm0uh7.us-east-1.aws.endpoints.huggingface.cloud")
@@ -8,8 +9,11 @@ ENDPOINT_URL = os.environ.get("ENDPOINT_URL", "https://dz0eq6vxq3nm0uh7.us-east-
8
  HF_API_TOKEN = os.environ.get("HF_API_TOKEN", "").strip() # Use strip() to remove extra whitespaces and newlines
9
 
10
 
11
- import requests
12
- import json
 
 
 
13
 
14
  # Assuming your class with extract_and_parse_json exists
15
  # Or you can define it separately if needed
 
1
  import gradio as gr
2
  import requests
3
  import os
4
+ import json
5
 
6
  # Configure the endpoint and authentication
7
  ENDPOINT_URL = os.environ.get("ENDPOINT_URL", "https://dz0eq6vxq3nm0uh7.us-east-1.aws.endpoints.huggingface.cloud")
 
9
  HF_API_TOKEN = os.environ.get("HF_API_TOKEN", "").strip() # Use strip() to remove extra whitespaces and newlines
10
 
11
 
12
+ def is_token_configured():
13
+ if not HF_API_TOKEN:
14
+ return "⚠️ Warning: HF_API_TOKEN is not configured. The app won't work until you add this secret in your Space settings."
15
+ return "✅ API token is configured"
16
+
17
 
18
  # Assuming your class with extract_and_parse_json exists
19
  # Or you can define it separately if needed