Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
{
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
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
|
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 |
|