aliceblue11 commited on
Commit
01b0b05
·
verified ·
1 Parent(s): eee6d03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,5 +1,12 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
 
 
 
 
 
 
 
3
 
4
  # Cohere Command R+ 모델 ID 정의
5
  COHERE_MODEL = "CohereForAI/c4ai-command-r-plus-08-2024"
@@ -47,9 +54,6 @@ def respond_cohere_qna(
47
  # UI 설정
48
  #############################
49
 
50
- # HuggingFace 토큰을 변수에 저장
51
- HUGGINGFACE_TOKEN = "YOUR_HUGGINGFACE_TOKEN"
52
-
53
  with gr.Blocks() as demo:
54
  gr.Markdown("# 블로그 생성기")
55
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ import os # Secrets에서 토큰을 가져오기 위한 라이브러리
4
+
5
+ # Secrets에서 HuggingFace 토큰 가져오기
6
+ HUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")
7
+
8
+ if not HUGGINGFACE_TOKEN:
9
+ raise ValueError("HUGGINGFACE_TOKEN 환경 변수에 유효한 토큰이 설정되어 있지 않습니다.")
10
 
11
  # Cohere Command R+ 모델 ID 정의
12
  COHERE_MODEL = "CohereForAI/c4ai-command-r-plus-08-2024"
 
54
  # UI 설정
55
  #############################
56
 
 
 
 
57
  with gr.Blocks() as demo:
58
  gr.Markdown("# 블로그 생성기")
59