File size: 449 Bytes
22d7b97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from huggingface_hub import HfApi


SECRET_CONFIG = os.environ["SECRET_CONFIG"]
HF_TOKEN = os.environ["HF_TOKEN"]

# Read the content of the file .env.template
with open(".env.template", "r") as f:
    PUBLIC_CONFIG = f.read()

# Prepend the content of the env variable SECRET_CONFIG
full_config = f"{PUBLIC_CONFIG}\n{SECRET_CONFIG}"

api = HfApi()

api.add_space_secret("huggingchat/chat-ui", "DOTENV_LOCAL", full_config, token=HF_TOKEN)