NCTCMumbai commited on
Commit
74ee3b7
1 Parent(s): d9fce56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -29,7 +29,7 @@ def system_instructions(question_difficulty, topic, documents_str):
29
 
30
  # RA
31
  RAG_db = gr.State()
32
-
33
  def json_to_excel(output_json):
34
  # Initialize list for DataFrame
35
  data = []
@@ -155,13 +155,16 @@ with gr.Blocks(title="Quiz Maker", theme=colorful_theme) as QUIZBOT:
155
  try:
156
  response = client.predict(query=formatted_prompt, history=[], system="You are a helpful assistant.", api_name="/model_chat")
157
  response1 = response[1][0][1]
158
-
159
  # Extract JSON
160
  start_index = response1.find('{')
161
  end_index = response1.rfind('}')
162
  cleaned_response = response1[start_index:end_index + 1] if start_index != -1 and end_index != -1 else ''
 
163
  output_json = json.loads(cleaned_response)
164
-
 
 
165
  # Generate the Excel file
166
  excel_file = json_to_excel(output_json)
167
 
 
29
 
30
  # RA
31
  RAG_db = gr.State()
32
+ quiz_data = None
33
  def json_to_excel(output_json):
34
  # Initialize list for DataFrame
35
  data = []
 
155
  try:
156
  response = client.predict(query=formatted_prompt, history=[], system="You are a helpful assistant.", api_name="/model_chat")
157
  response1 = response[1][0][1]
158
+
159
  # Extract JSON
160
  start_index = response1.find('{')
161
  end_index = response1.rfind('}')
162
  cleaned_response = response1[start_index:end_index + 1] if start_index != -1 and end_index != -1 else ''
163
+ print('Cleaned Response :',cleaned_response)
164
  output_json = json.loads(cleaned_response)
165
+ # Assign the extracted JSON to quiz_data for use in the comparison function
166
+ global quiz_data
167
+ quiz_data = output_json
168
  # Generate the Excel file
169
  excel_file = json_to_excel(output_json)
170