rashid01 commited on
Commit
886beae
·
verified ·
1 Parent(s): 5d87456

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -12
app.py CHANGED
@@ -15,13 +15,16 @@ def generate_questions(model_choice, role, question_type, num_questions, difficu
15
  f"Generate {num_questions} {difficulty} {question_type.lower()} interview questions for the role of {role}. "
16
  f"Only include {question_type.lower()} questions."
17
  )
18
- response = openai.Completion(
19
- model="text-davinci-003", # Adjust to the appropriate model if needed
20
- prompt=prompt,
 
 
 
21
  max_tokens=150,
22
  temperature=0.7
23
  )
24
- return response.choices[0].text.strip()
25
  elif model_choice == "Gemini":
26
  # Handle Gemini model logic
27
  pass
@@ -31,13 +34,16 @@ def generate_questions(model_choice, role, question_type, num_questions, difficu
31
  def provide_feedback(model_choice, answer):
32
  if model_choice == "OpenAI":
33
  prompt = f"Provide constructive feedback on the following interview answer: {answer}"
34
- response = openai.Completion.create(
35
- model="text-davinci-003", # Adjust to the appropriate model if needed
36
- prompt=prompt,
 
 
 
37
  max_tokens=150,
38
  temperature=0.7
39
  )
40
- return response.choices[0].text.strip()
41
  elif model_choice == "Gemini":
42
  # Handle Gemini model logic
43
  pass
@@ -47,13 +53,16 @@ def provide_feedback(model_choice, answer):
47
  def get_tips(model_choice, role):
48
  if model_choice == "OpenAI":
49
  prompt = f"Provide useful interview tips for the role of {role}. Include body language, dress code, etiquette, and role-specific advice."
50
- response = openai.Completion.create(
51
- model="text-davinci-003", # Adjust to the appropriate model if needed
52
- prompt=prompt,
 
 
 
53
  max_tokens=150,
54
  temperature=0.7
55
  )
56
- return response.choices[0].text.strip()
57
  elif model_choice == "Gemini":
58
  # Handle Gemini model logic
59
  pass
 
15
  f"Generate {num_questions} {difficulty} {question_type.lower()} interview questions for the role of {role}. "
16
  f"Only include {question_type.lower()} questions."
17
  )
18
+ response = openai.ChatCompletion.create(
19
+ model="gpt-3.5-turbo", # Use an appropriate model
20
+ messages=[
21
+ {"role": "system", "content": "You are a helpful assistant."},
22
+ {"role": "user", "content": prompt}
23
+ ],
24
  max_tokens=150,
25
  temperature=0.7
26
  )
27
+ return response.choices[0].message['content'].strip()
28
  elif model_choice == "Gemini":
29
  # Handle Gemini model logic
30
  pass
 
34
  def provide_feedback(model_choice, answer):
35
  if model_choice == "OpenAI":
36
  prompt = f"Provide constructive feedback on the following interview answer: {answer}"
37
+ response = openai.ChatCompletion.create(
38
+ model="gpt-3.5-turbo", # Use an appropriate model
39
+ messages=[
40
+ {"role": "system", "content": "You are a helpful assistant."},
41
+ {"role": "user", "content": prompt}
42
+ ],
43
  max_tokens=150,
44
  temperature=0.7
45
  )
46
+ return response.choices[0].message['content'].strip()
47
  elif model_choice == "Gemini":
48
  # Handle Gemini model logic
49
  pass
 
53
  def get_tips(model_choice, role):
54
  if model_choice == "OpenAI":
55
  prompt = f"Provide useful interview tips for the role of {role}. Include body language, dress code, etiquette, and role-specific advice."
56
+ response = openai.ChatCompletion.create(
57
+ model="gpt-3.5-turbo", # Use an appropriate model
58
+ messages=[
59
+ {"role": "system", "content": "You are a helpful assistant."},
60
+ {"role": "user", "content": prompt}
61
+ ],
62
  max_tokens=150,
63
  temperature=0.7
64
  )
65
+ return response.choices[0].message['content'].strip()
66
  elif model_choice == "Gemini":
67
  # Handle Gemini model logic
68
  pass