ajitkumar22 commited on
Commit
321f9ea
·
verified ·
1 Parent(s): 741fdb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -12,7 +12,10 @@ import os
12
  from huggingface_hub import InferenceClient
13
 
14
  HF_API_KEY = os.getenv("HF_API_KEY")
15
- client = InferenceClient(HF_API_KEY)
 
 
 
16
 
17
  response = client.text_generation("Hello!", model="Qwen/Qwen2.5-Coder-32B-Instruct")
18
  print(response)
 
12
  from huggingface_hub import InferenceClient
13
 
14
  HF_API_KEY = os.getenv("HF_API_KEY")
15
+ if not HF_API_KEY:
16
+ raise ValueError("HF_API_KEY is not set. Please add it as a secret in your Hugging Face Space settings.")
17
+
18
+ client = InferenceClient(token=HF_API_KEY)
19
 
20
  response = client.text_generation("Hello!", model="Qwen/Qwen2.5-Coder-32B-Instruct")
21
  print(response)