JUNGU commited on
Commit
9447f48
β€’
1 Parent(s): db341eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -23
app.py CHANGED
@@ -32,28 +32,23 @@ def generate_annotated_text(text):
32
  return response['choices'][0]['message']['content']
33
 
34
  #μœ μ‚¬ν•œ λ¬Έμž₯ 생성 ν•¨μˆ˜
35
- def generate_similar_sentences(base_sentence, num_sentences):
36
- generated_sentences = []
37
- for _ in range(num_sentences):
38
- response = openai.ChatCompletion.create(
39
- model="gpt-3.5-turbo-16k",
40
- messages=[
41
- {
42
- "role": "system",
43
- "content": "μœ μ‚¬ν•œ λ¬Έμž₯ 생성\n μ„ νƒλœ λ¬Έμž₯에 κΈ°λ°˜ν•˜μ—¬ ν•™μƒμ˜ νŠΉμ„± 및 ν™œλ™μ— λŒ€ν•œ 평가 μ˜ˆμ‹œ λ¬Έμž₯을 30개 μƒμ„±ν•©λ‹ˆλ‹€."
44
- },
45
- {
46
- "role": "user",
47
- "content": base_sentence
48
- }
49
- ],
50
- temperature=1,
51
- max_tokens=10000,
52
- top_p=1,
53
- frequency_penalty=0,
54
- presence_penalty=0
55
- )
56
- generated_sentences.append(response.choices[0].message['content'].strip())
57
  return generated_sentences
58
 
59
 
@@ -100,7 +95,7 @@ if st.button("평가 생성"):
100
  # μœ μ‚¬ν•œ λ¬Έμž₯ 생성 λ²„νŠΌ μΆ”κ°€
101
  if st.button("μœ μ‚¬ν•œ 문ꡬ 생성"):
102
  with st.spinner('λ¬Έμž₯ 생성쀑...'):
103
- similar_sentences = generate_similar_sentences(selected_sentence, 30)
104
  for sentence in similar_sentences:
105
  st.write(sentence)
106
 
 
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
 
 
95
  # μœ μ‚¬ν•œ λ¬Έμž₯ 생성 λ²„νŠΌ μΆ”κ°€
96
  if st.button("μœ μ‚¬ν•œ 문ꡬ 생성"):
97
  with st.spinner('λ¬Έμž₯ 생성쀑...'):
98
+ similar_sentences = generate_similar_sentences(selected_sentence)
99
  for sentence in similar_sentences:
100
  st.write(sentence)
101