Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import openai
|
|
4 |
import anthropic
|
5 |
import os
|
6 |
|
7 |
-
# Cohere
|
8 |
-
COHERE_MODEL = "CohereForAI/c4ai-command-r-plus-08-2024"
|
9 |
|
10 |
def get_client(model_name: str):
|
11 |
"""
|
@@ -16,10 +16,8 @@ def get_client(model_name: str):
|
|
16 |
if not hf_token:
|
17 |
raise ValueError("HuggingFace API 토큰이 필요합니다. (환경변수 HF_TOKEN 미설정)")
|
18 |
|
19 |
-
if model_name == "c4ai-command-r-
|
20 |
-
model_id = "CohereForAI/c4ai-command-r-
|
21 |
-
elif model_name == "c4ai-command-r7b-12-2024":
|
22 |
-
model_id = "CohereForAI/c4ai-command-r7b-12-2024"
|
23 |
else:
|
24 |
raise ValueError("유효하지 않은 모델 이름입니다.")
|
25 |
return InferenceClient(model_id, token=hf_token)
|
@@ -34,7 +32,7 @@ def cohere_respond(
|
|
34 |
top_p,
|
35 |
):
|
36 |
"""
|
37 |
-
Cohere
|
38 |
HF 토큰은 함수 내부에서 os.environ을 통해 불러온다.
|
39 |
"""
|
40 |
model_name = cohere_model_choice
|
@@ -226,7 +224,7 @@ with gr.Blocks() as demo:
|
|
226 |
# 일반 모델 관련 UI/기능 제거 (요청 사항에 따라 삭제)
|
227 |
# --------------------------------------------------
|
228 |
|
229 |
-
# Cohere Command R+ 탭 (모델 선택
|
230 |
with gr.Tab("Cohere Command R+"):
|
231 |
with gr.Row():
|
232 |
cohere_system_message = gr.Textbox(
|
@@ -238,8 +236,8 @@ with gr.Blocks() as demo:
|
|
238 |
lines=3
|
239 |
)
|
240 |
cohere_model_choice = gr.Radio(
|
241 |
-
choices=["c4ai-command-r-
|
242 |
-
value="c4ai-command-r-
|
243 |
label="모델 선택"
|
244 |
)
|
245 |
cohere_max_tokens = gr.Slider(minimum=100, maximum=8000, value=2000, step=100, label="Max new tokens")
|
|
|
4 |
import anthropic
|
5 |
import os
|
6 |
|
7 |
+
# Cohere 모델 ID 참고용 상수 (이전 모델은 사용하지 않습니다)
|
8 |
+
# COHERE_MODEL = "CohereForAI/c4ai-command-r-plus-08-2024"
|
9 |
|
10 |
def get_client(model_name: str):
|
11 |
"""
|
|
|
16 |
if not hf_token:
|
17 |
raise ValueError("HuggingFace API 토큰이 필요합니다. (환경변수 HF_TOKEN 미설정)")
|
18 |
|
19 |
+
if model_name == "c4ai-command-r-08-2024":
|
20 |
+
model_id = "CohereForAI/c4ai-command-r-08-2024"
|
|
|
|
|
21 |
else:
|
22 |
raise ValueError("유효하지 않은 모델 이름입니다.")
|
23 |
return InferenceClient(model_id, token=hf_token)
|
|
|
32 |
top_p,
|
33 |
):
|
34 |
"""
|
35 |
+
Cohere 모델 응답 함수.
|
36 |
HF 토큰은 함수 내부에서 os.environ을 통해 불러온다.
|
37 |
"""
|
38 |
model_name = cohere_model_choice
|
|
|
224 |
# 일반 모델 관련 UI/기능 제거 (요청 사항에 따라 삭제)
|
225 |
# --------------------------------------------------
|
226 |
|
227 |
+
# Cohere Command R+ 탭 (모델 선택 수정됨)
|
228 |
with gr.Tab("Cohere Command R+"):
|
229 |
with gr.Row():
|
230 |
cohere_system_message = gr.Textbox(
|
|
|
236 |
lines=3
|
237 |
)
|
238 |
cohere_model_choice = gr.Radio(
|
239 |
+
choices=["c4ai-command-r-08-2024"],
|
240 |
+
value="c4ai-command-r-08-2024",
|
241 |
label="모델 선택"
|
242 |
)
|
243 |
cohere_max_tokens = gr.Slider(minimum=100, maximum=8000, value=2000, step=100, label="Max new tokens")
|