Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
38 |
-
|
39 |
{
|
40 |
"role": "system",
|
41 |
-
"content": f"
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
-
|
44 |
],
|
45 |
-
temperature=
|
46 |
max_tokens=10000,
|
47 |
top_p=1,
|
48 |
frequency_penalty=0,
|
49 |
presence_penalty=0
|
50 |
)
|
51 |
-
generated_sentences
|
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 μ±μ μ λͺ© λ° μ€λͺ
|