K00B404 commited on
Commit
5603f55
1 Parent(s): 370a105

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -14,15 +14,17 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
14
  is_api_call = huggingface_api_key is not None
15
 
16
  if is_api_call:
 
 
 
 
 
 
17
  # Validate the API key if it's an API call
18
  if huggingface_api_key == "":
19
  raise gr.Error("API key is required for API calls.")
20
 
21
  headers = {"Authorization": f"Bearer {huggingface_api_key}"}
22
- else:
23
- # Use the environment variable for the API key in GUI mode
24
- API_TOKEN = os.getenv("HF_READ_TOKEN")
25
- headers = {"Authorization": f"Bearer {API_TOKEN}"}
26
 
27
  if prompt == "" or prompt is None:
28
  return None
 
14
  is_api_call = huggingface_api_key is not None
15
 
16
  if is_api_call:
17
+
18
+ # Use the environment variable for the API key in GUI mode
19
+ API_TOKEN = os.getenv("HF_READ_TOKEN")
20
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
21
+
22
+ else:
23
  # Validate the API key if it's an API call
24
  if huggingface_api_key == "":
25
  raise gr.Error("API key is required for API calls.")
26
 
27
  headers = {"Authorization": f"Bearer {huggingface_api_key}"}
 
 
 
 
28
 
29
  if prompt == "" or prompt is None:
30
  return None