koh1018 commited on
Commit
effaff8
·
1 Parent(s): 9524131

프롬프트 답변 방식 변경

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -61,12 +61,11 @@ async def translate(request: TranslationRequest):
61
  do_sample=True,
62
  temperature=0.7,
63
  top_k=50,
 
64
  )
65
 
66
  # 결과물에서 필요한 부분만 추출
67
- generated_text = outputs[0]["generated_text"]
68
- # 'assistant\n' 다음에 오는 실제 번역 결과만 깔끔하게 잘라내기
69
- translated_text = generated_text.split("assistant\n")[-1].strip()
70
 
71
  # 프론트엔드에 번역된 텍스트를 JSON 형태로 반환
72
  return {"translated_text": translated_text}
@@ -89,10 +88,10 @@ async def get_pronunciation(request: PronunciationRequest):
89
  do_sample=True,
90
  temperature=0.7,
91
  top_k=50,
 
92
  )
93
 
94
- generated_text = outputs[0]["generated_text"]
95
- pronunciation_text = generated_text.split("assistant\n")[-1].strip()
96
 
97
  return {"pronunciation_text": pronunciation_text}
98
 
 
61
  do_sample=True,
62
  temperature=0.7,
63
  top_k=50,
64
+ return_full_text=False,
65
  )
66
 
67
  # 결과물에서 필요한 부분만 추출
68
+ translated_text = outputs[0]["generated_text"].strip()
 
 
69
 
70
  # 프론트엔드에 번역된 텍스트를 JSON 형태로 반환
71
  return {"translated_text": translated_text}
 
88
  do_sample=True,
89
  temperature=0.7,
90
  top_k=50,
91
+ return_full_text=False,
92
  )
93
 
94
+ pronunciation_text = outputs[0]["generated_text"].strip()
 
95
 
96
  return {"pronunciation_text": pronunciation_text}
97