Kims12 commited on
Commit
29e744b
·
verified ·
1 Parent(s): 2bbb5a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -99,7 +99,8 @@ def respond_deepseek_qna(
99
  system_message: str,
100
  max_tokens: int,
101
  temperature: float,
102
- top_p: float
 
103
  ):
104
  """
105
  DeepSeek 모델을 이용해 한 번의 질문(question)에 대한 답변을 반환하는 함수.
@@ -118,7 +119,7 @@ def respond_deepseek_qna(
118
 
119
  try:
120
  response = openai.ChatCompletion.create(
121
- model="deepseek-chat",
122
  messages=messages,
123
  max_tokens=max_tokens,
124
  temperature=temperature,
@@ -344,6 +345,13 @@ with gr.Blocks() as demo:
344
  # DeepSeek 탭
345
  #################
346
  with gr.Tab("DeepSeek-V3"):
 
 
 
 
 
 
 
347
  deepseek_input1 = gr.Textbox(label="입력1", lines=1)
348
  deepseek_input2 = gr.Textbox(label="입력2", lines=1)
349
  deepseek_input3 = gr.Textbox(label="입력3", lines=1)
@@ -367,14 +375,21 @@ with gr.Blocks() as demo:
367
 
368
  deepseek_submit_button = gr.Button("전송")
369
 
370
- def merge_and_call_deepseek(i1, i2, i3, i4, i5, sys_msg, mt, temp, top_p_):
 
 
 
 
 
 
371
  question = " ".join([i1, i2, i3, i4, i5])
372
  return respond_deepseek_qna(
373
  question=question,
374
  system_message=sys_msg,
375
  max_tokens=mt,
376
  temperature=temp,
377
- top_p=top_p_
 
378
  )
379
 
380
  deepseek_submit_button.click(
@@ -384,7 +399,8 @@ with gr.Blocks() as demo:
384
  deepseek_system_message,
385
  deepseek_max_tokens,
386
  deepseek_temperature,
387
- deepseek_top_p
 
388
  ],
389
  outputs=deepseek_answer_output
390
  )
@@ -393,4 +409,4 @@ with gr.Blocks() as demo:
393
  # 메인 실행부
394
  #############################
395
  if __name__ == "__main__":
396
- demo.launch()
 
99
  system_message: str,
100
  max_tokens: int,
101
  temperature: float,
102
+ top_p: float,
103
+ model_name: str # 모델 이름 추가
104
  ):
105
  """
106
  DeepSeek 모델을 이용해 한 번의 질문(question)에 대한 답변을 반환하는 함수.
 
119
 
120
  try:
121
  response = openai.ChatCompletion.create(
122
+ model=model_name, # 선택된 모델 사용
123
  messages=messages,
124
  max_tokens=max_tokens,
125
  temperature=temperature,
 
345
  # DeepSeek 탭
346
  #################
347
  with gr.Tab("DeepSeek-V3"):
348
+ # 라디오 버튼 추가
349
+ deepseek_model_radio = gr.Radio(
350
+ choices=["V3 (deepseek-chat)", "R1 (deepseek-reasoner)"], # 선택지
351
+ label="모델 선택", # 라벨
352
+ value="V3 (deepseek-chat)" # 기본값
353
+ )
354
+
355
  deepseek_input1 = gr.Textbox(label="입력1", lines=1)
356
  deepseek_input2 = gr.Textbox(label="입력2", lines=1)
357
  deepseek_input3 = gr.Textbox(label="입력3", lines=1)
 
375
 
376
  deepseek_submit_button = gr.Button("전송")
377
 
378
+ def merge_and_call_deepseek(i1, i2, i3, i4, i5, sys_msg, mt, temp, top_p_, model_radio):
379
+ # 라디오 버튼에서 선택된 모델 이름 추출
380
+ if model_radio == "V3 (deepseek-chat)":
381
+ model_name = "deepseek-chat"
382
+ else:
383
+ model_name = "deepseek-reasoner"
384
+
385
  question = " ".join([i1, i2, i3, i4, i5])
386
  return respond_deepseek_qna(
387
  question=question,
388
  system_message=sys_msg,
389
  max_tokens=mt,
390
  temperature=temp,
391
+ top_p=top_p_,
392
+ model_name=model_name # 선택된 모델 이름 전달
393
  )
394
 
395
  deepseek_submit_button.click(
 
399
  deepseek_system_message,
400
  deepseek_max_tokens,
401
  deepseek_temperature,
402
+ deepseek_top_p,
403
+ deepseek_model_radio # 라디오 버튼 입력 추가
404
  ],
405
  outputs=deepseek_answer_output
406
  )
 
409
  # 메인 실행부
410
  #############################
411
  if __name__ == "__main__":
412
+ demo.launch()