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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -47,13 +47,19 @@ 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
 
56
- input1 = gr.Textbox(label="말투바꾸기", lines=1)
 
 
 
 
 
 
57
  input2 = gr.Textbox(label="참조글1", lines=1)
58
  input3 = gr.Textbox(label="참조글2", lines=1)
59
  input4 = gr.Textbox(label="참조글3", lines=1)
@@ -92,8 +98,8 @@ with gr.Blocks() as demo:
92
 
93
  submit_button = gr.Button("전송")
94
 
95
- def merge_and_call_cohere(i1, i2, i3, i4, i5):
96
- question = " ".join([i1, i2, i3, i4, i5])
97
  return respond_cohere_qna(
98
  question=question,
99
  system_message=system_message,
@@ -105,7 +111,7 @@ with gr.Blocks() as demo:
105
 
106
  submit_button.click(
107
  fn=merge_and_call_cohere,
108
- inputs=[input1, input2, input3, input4, input5],
109
  outputs=answer_output
110
  )
111
 
 
47
  # UI 설정
48
  #############################
49
 
50
+ # HuggingFace 토큰을 변수에 저장
51
  HUGGINGFACE_TOKEN = "YOUR_HUGGINGFACE_TOKEN"
52
 
53
  with gr.Blocks() as demo:
54
  gr.Markdown("# 블로그 생성기")
55
 
56
+ # 라디오 버튼으로 말투 선택
57
+ tone_selection = gr.Radio(
58
+ choices=["친근한", "전문적인", "상품후기"],
59
+ label="말투바꾸기",
60
+ value="친근한"
61
+ )
62
+
63
  input2 = gr.Textbox(label="참조글1", lines=1)
64
  input3 = gr.Textbox(label="참조글2", lines=1)
65
  input4 = gr.Textbox(label="참조글3", lines=1)
 
98
 
99
  submit_button = gr.Button("전송")
100
 
101
+ def merge_and_call_cohere(tone, i2, i3, i4, i5):
102
+ question = f"말투: {tone}\n참고글1: {i2}\n참고글2: {i3}\n참고글3: {i4}\n요청 내용: {i5}"
103
  return respond_cohere_qna(
104
  question=question,
105
  system_message=system_message,
 
111
 
112
  submit_button.click(
113
  fn=merge_and_call_cohere,
114
+ inputs=[tone_selection, input2, input3, input4, input5],
115
  outputs=answer_output
116
  )
117