Kims12 commited on
Commit
bfcb9e7
·
verified ·
1 Parent(s): 16edf41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -79,7 +79,12 @@ with gr.Blocks() as demo:
79
  # 전송 버튼
80
  submit_button = gr.Button("생성")
81
 
82
- def generate_blog(tone, ref1, ref2, ref3, hf_token):
 
 
 
 
 
83
  # 프롬프트 구성
84
  prompt = f"말투: {tone}\n참조글 1: {ref1}\n참조글 2: {ref2}\n참조글 3: {ref3}"
85
  return respond_cohere_qna(
@@ -88,12 +93,12 @@ with gr.Blocks() as demo:
88
  max_tokens=MAX_TOKENS,
89
  temperature=TEMPERATURE,
90
  top_p=TOP_P,
91
- hf_token=hf_token
92
  )
93
 
94
  submit_button.click(
95
  fn=generate_blog,
96
- inputs=[tone, ref1, ref2, ref3, hf_token],
97
  outputs=answer_output
98
  )
99
 
 
79
  # 전송 버튼
80
  submit_button = gr.Button("생성")
81
 
82
+ def generate_blog(tone, ref1, ref2, ref3):
83
+ # HuggingFace 토큰은 함수 내부에서 직접 사용
84
+ hf_token_value = os.getenv("HF_TOKEN")
85
+ if not hf_token_value:
86
+ return "HuggingFace 토큰이 설정되지 않았습니다."
87
+
88
  # 프롬프트 구성
89
  prompt = f"말투: {tone}\n참조글 1: {ref1}\n참조글 2: {ref2}\n참조글 3: {ref3}"
90
  return respond_cohere_qna(
 
93
  max_tokens=MAX_TOKENS,
94
  temperature=TEMPERATURE,
95
  top_p=TOP_P,
96
+ hf_token=hf_token_value
97
  )
98
 
99
  submit_button.click(
100
  fn=generate_blog,
101
+ inputs=[tone, ref1, ref2, ref3], # hf_token은 제외
102
  outputs=answer_output
103
  )
104