Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,21 +7,25 @@ client = OpenAI(
|
|
7 |
)
|
8 |
|
9 |
myTitle = "✏️ Schreif mer e Gedicht ! 🇱🇺"
|
10 |
-
myDescription = "
|
11 |
-
myArticle = "
|
12 |
-
|
13 |
prompt_start = "Schreif mer e Gedicht op Lëtzebuergesch iwwert "
|
14 |
myExamples = [
|
15 |
"eng Blumm där hire gréisste Wonsch ass ze fléien",
|
16 |
-
"eng Giraff déi traureg ass well se hire Puppelchen verluer huet",
|
17 |
"zwee kleng Huesen déi Angscht vun der Däischtert hunn"
|
18 |
]
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# Function to get a response from GPT-4
|
21 |
def schreiw_gedicht(prompt):
|
22 |
GPT_MODEL = "gpt-4"
|
23 |
MESSAGES =[
|
24 |
-
{"role": "system", "content":
|
25 |
{"role": "user", "content": prompt},
|
26 |
]
|
27 |
try:
|
@@ -29,7 +33,7 @@ def schreiw_gedicht(prompt):
|
|
29 |
response = client.chat.completions.create(
|
30 |
model = GPT_MODEL,
|
31 |
messages = MESSAGES,
|
32 |
-
max_tokens =
|
33 |
temperature = 0.7, # Adjust temperature for creativity
|
34 |
)
|
35 |
# Extract the assistant's response
|
|
|
7 |
)
|
8 |
|
9 |
myTitle = "✏️ Schreif mer e Gedicht ! 🇱🇺"
|
10 |
+
myDescription = "A"
|
11 |
+
myArticle = "B"
|
|
|
12 |
prompt_start = "Schreif mer e Gedicht op Lëtzebuergesch iwwert "
|
13 |
myExamples = [
|
14 |
"eng Blumm där hire gréisste Wonsch ass ze fléien",
|
|
|
15 |
"zwee kleng Huesen déi Angscht vun der Däischtert hunn"
|
16 |
]
|
17 |
|
18 |
+
INSTRUCTIONS = """You are a writer creating poems in Luxembourgish.
|
19 |
+
In the prompt the user defines a story, ideas and emotions.
|
20 |
+
Your role is to embed these elements into a sonnet, a fixed verse poetic form, consisting of fourteen lines adhering to a set rhyming scheme.
|
21 |
+
Even when a users submit prompts in another language, you provide your sonnet in Luxembourgish.
|
22 |
+
"""
|
23 |
+
|
24 |
# Function to get a response from GPT-4
|
25 |
def schreiw_gedicht(prompt):
|
26 |
GPT_MODEL = "gpt-4"
|
27 |
MESSAGES =[
|
28 |
+
{"role": "system", "content": Instructions},
|
29 |
{"role": "user", "content": prompt},
|
30 |
]
|
31 |
try:
|
|
|
33 |
response = client.chat.completions.create(
|
34 |
model = GPT_MODEL,
|
35 |
messages = MESSAGES,
|
36 |
+
max_tokens = 500, # Adjust max tokens as needed
|
37 |
temperature = 0.7, # Adjust temperature for creativity
|
38 |
)
|
39 |
# Extract the assistant's response
|