acecalisto3 commited on
Commit
4c97a60
·
verified ·
1 Parent(s): f13ca88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -4,8 +4,16 @@ import subprocess
4
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
5
  from huggingface_hub import HfApi
6
 
7
- # Set your Hugging Face API key here
8
- huggingface_token = st.secrets["huggingface"]["hf_token"]
 
 
 
 
 
 
 
 
9
 
10
  PROJECT_ROOT = "projects"
11
  AGENT_DIRECTORY = "agents"
 
4
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
5
  from huggingface_hub import HfApi
6
 
7
+ import json
8
+
9
+ try:
10
+ huggingface_json = st.secrets["huggingface"]
11
+ except Exception as e:
12
+ print("Unable to load secrets: ", str(e))
13
+ raise
14
+
15
+ huggingface_data = json.loads(huggingface_json)
16
+ huggingface_token = huggingface_data["hf_token"]
17
 
18
  PROJECT_ROOT = "projects"
19
  AGENT_DIRECTORY = "agents"