Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ from groq import Groq
|
|
4 |
import markdown
|
5 |
|
6 |
# Retrieve system prompts from environment variables
|
7 |
-
GENERATE_PROMPT = os.environ.get("
|
8 |
-
HUMANIZE_PROMPT = os.environ.get("
|
9 |
|
10 |
def generate_mba_content(topic, api_key):
|
11 |
if not GENERATE_PROMPT:
|
@@ -19,12 +19,12 @@ def generate_mba_content(topic, api_key):
|
|
19 |
prompt = GENERATE_PROMPT.replace("[TOPIC]", topic)
|
20 |
try:
|
21 |
response = client.chat.completions.create(
|
22 |
-
model="
|
23 |
messages=[
|
24 |
{"role": "system", "content": prompt},
|
25 |
{"role": "user", "content": f"Generate content for the topic: {topic}"}
|
26 |
],
|
27 |
-
temperature=0.
|
28 |
max_tokens=4000
|
29 |
)
|
30 |
content = response.choices[0].message.content
|
@@ -51,12 +51,12 @@ def humanize_text(text, api_key):
|
|
51 |
prompt = HUMANIZE_PROMPT.replace("[TEXT]", text)
|
52 |
try:
|
53 |
response = client.chat.completions.create(
|
54 |
-
model="
|
55 |
messages=[
|
56 |
{"role": "system", "content": prompt},
|
57 |
{"role": "user", "content": f"Rewrite the following text: {text}"}
|
58 |
],
|
59 |
-
temperature=0.
|
60 |
max_tokens=4000
|
61 |
)
|
62 |
content = response.choices[0].message.content
|
|
|
4 |
import markdown
|
5 |
|
6 |
# Retrieve system prompts from environment variables
|
7 |
+
GENERATE_PROMPT = os.environ.get("GENERATE_PROMPT")
|
8 |
+
HUMANIZE_PROMPT = os.environ.get("HUMANIZE_PROMPT")
|
9 |
|
10 |
def generate_mba_content(topic, api_key):
|
11 |
if not GENERATE_PROMPT:
|
|
|
19 |
prompt = GENERATE_PROMPT.replace("[TOPIC]", topic)
|
20 |
try:
|
21 |
response = client.chat.completions.create(
|
22 |
+
model="llama-3.3-70b-versatile",
|
23 |
messages=[
|
24 |
{"role": "system", "content": prompt},
|
25 |
{"role": "user", "content": f"Generate content for the topic: {topic}"}
|
26 |
],
|
27 |
+
temperature=0.5,
|
28 |
max_tokens=4000
|
29 |
)
|
30 |
content = response.choices[0].message.content
|
|
|
51 |
prompt = HUMANIZE_PROMPT.replace("[TEXT]", text)
|
52 |
try:
|
53 |
response = client.chat.completions.create(
|
54 |
+
model="llama-3.3-70b-versatile",
|
55 |
messages=[
|
56 |
{"role": "system", "content": prompt},
|
57 |
{"role": "user", "content": f"Rewrite the following text: {text}"}
|
58 |
],
|
59 |
+
temperature=0.5,
|
60 |
max_tokens=4000
|
61 |
)
|
62 |
content = response.choices[0].message.content
|