Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def respond_cohere_qna(
|
|
22 |
Cohere Command R+ 모델을 이용해 한 번의 질문(question)에 대한 답변을 반환하는 함수.
|
23 |
"""
|
24 |
try:
|
25 |
-
client = get_client(
|
26 |
except ValueError as e:
|
27 |
return f"오류: {str(e)}"
|
28 |
|
@@ -50,6 +50,12 @@ def respond_cohere_qna(
|
|
50 |
with gr.Blocks() as demo:
|
51 |
gr.Markdown("# 블로그 생성기")
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
input1 = gr.Textbox(label="말투바꾸기", lines=1)
|
54 |
input2 = gr.Textbox(label="참조글1", lines=1)
|
55 |
input3 = gr.Textbox(label="참조글2", lines=1)
|
@@ -89,11 +95,11 @@ with gr.Blocks() as demo:
|
|
89 |
|
90 |
submit_button = gr.Button("전송")
|
91 |
|
92 |
-
def merge_and_call_cohere(i1, i2, i3, i4, i5,
|
93 |
question = " ".join([i1, i2, i3, i4, i5])
|
94 |
return respond_cohere_qna(
|
95 |
question=question,
|
96 |
-
system_message=
|
97 |
max_tokens=4000,
|
98 |
temperature=0.7,
|
99 |
top_p=0.95,
|
@@ -103,8 +109,7 @@ with gr.Blocks() as demo:
|
|
103 |
submit_button.click(
|
104 |
fn=merge_and_call_cohere,
|
105 |
inputs=[
|
106 |
-
input1, input2, input3, input4, input5,
|
107 |
-
system_message
|
108 |
],
|
109 |
outputs=answer_output
|
110 |
)
|
|
|
22 |
Cohere Command R+ 모델을 이용해 한 번의 질문(question)에 대한 답변을 반환하는 함수.
|
23 |
"""
|
24 |
try:
|
25 |
+
client = get_client(hf_token)
|
26 |
except ValueError as e:
|
27 |
return f"오류: {str(e)}"
|
28 |
|
|
|
50 |
with gr.Blocks() as demo:
|
51 |
gr.Markdown("# 블로그 생성기")
|
52 |
|
53 |
+
hf_token_box = gr.Textbox(
|
54 |
+
label="HuggingFace 토큰",
|
55 |
+
type="password",
|
56 |
+
placeholder="HuggingFace API 토큰을 입력하세요..."
|
57 |
+
)
|
58 |
+
|
59 |
input1 = gr.Textbox(label="말투바꾸기", lines=1)
|
60 |
input2 = gr.Textbox(label="참조글1", lines=1)
|
61 |
input3 = gr.Textbox(label="참조글2", lines=1)
|
|
|
95 |
|
96 |
submit_button = gr.Button("전송")
|
97 |
|
98 |
+
def merge_and_call_cohere(i1, i2, i3, i4, i5, hf_token):
|
99 |
question = " ".join([i1, i2, i3, i4, i5])
|
100 |
return respond_cohere_qna(
|
101 |
question=question,
|
102 |
+
system_message=system_message,
|
103 |
max_tokens=4000,
|
104 |
temperature=0.7,
|
105 |
top_p=0.95,
|
|
|
109 |
submit_button.click(
|
110 |
fn=merge_and_call_cohere,
|
111 |
inputs=[
|
112 |
+
input1, input2, input3, input4, input5, hf_token_box
|
|
|
113 |
],
|
114 |
outputs=answer_output
|
115 |
)
|