Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
12 |
-
|
|
|
|
|
|
|
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
|