umair894 commited on
Commit
56ad0cb
·
1 Parent(s): af910e8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -9
main.py CHANGED
@@ -20,14 +20,14 @@ Output: A JSON response containing a list of questions and a corresponding list
20
 
21
  app = FastAPI(docs_url="/", description=description)
22
 
23
- def convert_format(input_dict):
24
- output_list = []
25
- for i in range(1, len(input_dict) // 2 + 1):
26
- question_key = f"Question {i}"
27
- answer_key = f"Answer {i}"
28
- if question_key in input_dict and answer_key in input_dict:
29
- output_list.append({"Question": input_dict[question_key], "Answer": input_dict[answer_key]})
30
- return output_list
31
 
32
  @app.post("/get_questions")
33
  async def getQuestions(job_description: str, no_of_questions: int):
@@ -46,6 +46,6 @@ async def getQuestions(job_description: str, no_of_questions: int):
46
  # Parse the JSON data
47
  parsed_data = json.loads(result)
48
  print(parsed_data)
49
- parsed_data = convert_format(parsed_data)
50
 
51
  return parsed_data
 
20
 
21
  app = FastAPI(docs_url="/", description=description)
22
 
23
+ # def convert_format(input_dict):
24
+ # output_list = []
25
+ # for i in range(1, len(input_dict) // 2 + 1):
26
+ # question_key = f"Question {i}"
27
+ # answer_key = f"Answer {i}"
28
+ # if question_key in input_dict and answer_key in input_dict:
29
+ # output_list.append({"Question": input_dict[question_key], "Answer": input_dict[answer_key]})
30
+ # return output_list
31
 
32
  @app.post("/get_questions")
33
  async def getQuestions(job_description: str, no_of_questions: int):
 
46
  # Parse the JSON data
47
  parsed_data = json.loads(result)
48
  print(parsed_data)
49
+ # parsed_data = convert_format(parsed_data)
50
 
51
  return parsed_data