pratikshahp commited on
Commit
84164be
·
verified ·
1 Parent(s): 1403993

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -3,7 +3,7 @@ from openai import OpenAI
3
  from dotenv import load_dotenv
4
  import os
5
 
6
- # Load API key from .env
7
  load_dotenv()
8
  api_key = os.getenv("openai_api_key")
9
 
@@ -11,18 +11,26 @@ client = OpenAI(api_key=api_key)
11
 
12
  # Function to generate game cards based on job profile
13
  def generate_game_cards(job_profile):
14
- system_prompt = f"""Generate a complete set of game cards for the career {job_profile}. The output should include the following:
 
 
 
 
15
 
16
- Title: {job_profile}
17
- Overview: A short description of the role.
18
- Pros & Cons: List 3-4 key pros and cons.
19
- Dual Impact Highlights: Summarize how this career affects personal growth (e.g., satisfaction, skill development) and community impact (e.g., societal contributions, local development).
20
- response should be in a plain-text not in markdown or any format
 
21
  """
 
22
  response = client.chat.completions.create(
23
  model="gpt-4o-mini",
24
- messages=[{"role": "system", "content": "You are an interactive career card developer."},
25
- {"role": "user", "content": system_prompt}]
 
 
26
  )
27
  return response.choices[0].message.content
28
 
 
3
  from dotenv import load_dotenv
4
  import os
5
 
6
+ # Load API key
7
  load_dotenv()
8
  api_key = os.getenv("openai_api_key")
9
 
 
11
 
12
  # Function to generate game cards based on job profile
13
  def generate_game_cards(job_profile):
14
+ system_message = """You are an interactive career card developer.
15
+ Generate a plain-text game card for any career.
16
+ The response should NOT contain Markdown formatting, asterisks, or bullet points.
17
+ Keep the text structured but in simple plain text format.
18
+ """
19
 
20
+ user_message = f"""Provide a game card for the career: {job_profile}.
21
+ Include:
22
+ - Title: The job title.
23
+ - Overview: A short description of the role.
24
+ - Pros & Cons: List 3-4 key pros and cons in full sentences.
25
+ - Dual Impact Highlights: Explain how this career affects personal growth (skills, satisfaction) and community impact (society, economy).
26
  """
27
+
28
  response = client.chat.completions.create(
29
  model="gpt-4o-mini",
30
+ messages=[
31
+ {"role": "system", "content": system_message}, # System instructions
32
+ {"role": "user", "content": user_message} # User query with job details
33
+ ]
34
  )
35
  return response.choices[0].message.content
36