Mohinikathro commited on
Commit
ebe6196
·
verified ·
1 Parent(s): ce0100b

changes made to app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -119,7 +119,7 @@ def reset_state(domain, company, level):
119
  "level": level,
120
  "asked_questions": set(),
121
  "asked_subtopics": set(),
122
- "conversation": [] # List of (speaker, message) tuples
123
  }
124
 
125
  def start_interview(domain, company, level):
@@ -133,7 +133,7 @@ def start_interview(domain, company, level):
133
  "Generate the first question:")
134
 
135
  question = generate_question(prompt, domain, state)
136
- state["conversation"].append(("Interviewer", question))
137
  return state["conversation"], state
138
 
139
  def submit_response(candidate_response, state):
@@ -142,17 +142,17 @@ def submit_response(candidate_response, state):
142
  Allows quitting the interview by typing 'quit'.
143
  """
144
  if candidate_response.strip().lower() == "quit":
145
- state["conversation"].append(("Candidate", candidate_response))
146
- state["conversation"].append(("Interviewer", "Interview session has ended. Thank you for participating!"))
147
  return state["conversation"], state
148
 
149
- state["conversation"].append(("Candidate", candidate_response))
150
  prompt = (f"Domain: {state['domain']}. "
151
  f"Candidate's experience level: {state['level']}. "
152
  "Generate the next interview question:")
153
 
154
  question = generate_question(prompt, state["domain"], state)
155
- state["conversation"].append(("Interviewer", question))
156
  return state["conversation"], state
157
 
158
  # Build an interactive Gradio interface using Blocks
 
119
  "level": level,
120
  "asked_questions": set(),
121
  "asked_subtopics": set(),
122
+ "conversation": [] # List of {"role": ..., "content": ...}
123
  }
124
 
125
  def start_interview(domain, company, level):
 
133
  "Generate the first question:")
134
 
135
  question = generate_question(prompt, domain, state)
136
+ state["conversation"].append({"role": "Interviewer", "content": question})
137
  return state["conversation"], state
138
 
139
  def submit_response(candidate_response, state):
 
142
  Allows quitting the interview by typing 'quit'.
143
  """
144
  if candidate_response.strip().lower() == "quit":
145
+ state["conversation"].append({"role": "Candidate", "content": candidate_response})
146
+ state["conversation"].append({"role": "Interviewer", "content": "Interview session has ended. Thank you for participating!"})
147
  return state["conversation"], state
148
 
149
+ state["conversation"].append({"role": "Candidate", "content": candidate_response})
150
  prompt = (f"Domain: {state['domain']}. "
151
  f"Candidate's experience level: {state['level']}. "
152
  "Generate the next interview question:")
153
 
154
  question = generate_question(prompt, state["domain"], state)
155
+ state["conversation"].append({"role": "Interviewer", "content": question})
156
  return state["conversation"], state
157
 
158
  # Build an interactive Gradio interface using Blocks