JUNGU commited on
Commit
123222c
Β·
1 Parent(s): e2967cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -31,25 +31,28 @@ def generate_annotated_text(text):
31
  )
32
  return response['choices'][0]['message']['content']
33
 
34
- #μœ μ‚¬ν•œ λ¬Έμž₯ 생성 ν•¨μˆ˜
35
  def generate_similar_sentences(base_sentence):
36
  response = openai.ChatCompletion.create(
37
- model="gpt-3.5-turbo-16k",
38
- messages=[
39
  {
40
  "role": "system",
41
- "content": f"μœ μ‚¬ν•œ λ¬Έμž₯ 생성\n {base_sentence}에 κΈ°λ°˜ν•˜μ—¬ ν•™μƒμ˜ νŠΉμ„± 및 ν™œλ™μ— λŒ€ν•œ 평가 μ˜ˆμ‹œ λ¬Έμž₯을 30개 μƒμ„±ν•©λ‹ˆλ‹€."
 
 
 
 
42
  }
43
-
44
  ],
45
- temperature=1,
46
  max_tokens=10000,
47
  top_p=1,
48
  frequency_penalty=0,
49
  presence_penalty=0
50
  )
51
- generated_sentences.append(response.choices[0].message['content'].strip())
52
- return generated_sentences
53
 
54
 
55
  # Streamlit μ•±μ˜ 제λͺ© 및 μ„€λͺ…
 
31
  )
32
  return response['choices'][0]['message']['content']
33
 
34
+ # μœ μ‚¬ν•œ λ¬Έμž₯ 생성 ν•¨μˆ˜
35
  def generate_similar_sentences(base_sentence):
36
  response = openai.ChatCompletion.create(
37
+ model="gpt-3.5-turbo-16k",
38
+ messages=[
39
  {
40
  "role": "system",
41
+ "content": f"λ‹€μŒμ€ '{base_sentence}'와 μœ μ‚¬ν•œ 30개의 λ¬Έμž₯을 μƒμ„±ν•©λ‹ˆλ‹€. 각 λ¬Έμž₯은 독립적이고 μœ μ‚¬ν•œ λ‚΄μš©μ„ λ‹΄κ³  μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€:"
42
+ },
43
+ {
44
+ "role": "user",
45
+ "content": base_sentence
46
  }
 
47
  ],
48
+ temperature=0.7,
49
  max_tokens=10000,
50
  top_p=1,
51
  frequency_penalty=0,
52
  presence_penalty=0
53
  )
54
+ generated_sentences = response.choices[0].message['content'].split('\n')
55
+ return [sentence.strip() for sentence in generated_sentences if sentence.strip()]
56
 
57
 
58
  # Streamlit μ•±μ˜ 제λͺ© 및 μ„€λͺ