Samuel Thomas commited on
Commit
2260dcd
·
1 Parent(s): 5145d77

list of answers

Browse files
Files changed (2) hide show
  1. app.py +22 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -26,6 +26,24 @@ s2 = " FINAL ANSWER: Jane Doe"
26
  print(strip_final_answer(s2)) # Output: Jane Doe
27
 
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  # (Keep Constants as is)
30
  # --- Constants ---
31
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -158,7 +176,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
158
  f"({result_data.get('correct_count', '?')}/{result_data.get('total_attempted', '?')} correct)\n"
159
  f"Message: {result_data.get('message', 'No message received.')}"
160
  )
161
- print("Submission successful.")
 
 
162
  results_df = pd.DataFrame(results_log)
163
  return final_status, results_df
164
  except requests.exceptions.HTTPError as e:
@@ -187,6 +207,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
187
  print(status_message)
188
  results_df = pd.DataFrame(results_log)
189
  return status_message, results_df
 
190
 
191
  # --- Build Gradio Interface using Blocks ---
192
  with gr.Blocks() as demo:
 
26
  print(strip_final_answer(s2)) # Output: Jane Doe
27
 
28
 
29
+ def print_answers_dataframe(answers_payload):
30
+ # Create a list of question numbers from 1 to length of answers_payload
31
+ question_numbers = list(range(1, len(answers_payload) + 1))
32
+
33
+ # Extract task_id and submitted_answer from the list of dictionaries
34
+ task_ids = [item["task_id"] for item in answers_payload]
35
+ submitted_answers = [item["submitted_answer"] for item in answers_payload]
36
+
37
+ # Create the DataFrame
38
+ df = pd.DataFrame({
39
+ "question_number": question_numbers,
40
+ "task_id": task_ids,
41
+ "submitted_answer": submitted_answers
42
+ })
43
+
44
+ # Print the DataFrame
45
+ print(df)
46
+
47
  # (Keep Constants as is)
48
  # --- Constants ---
49
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
176
  f"({result_data.get('correct_count', '?')}/{result_data.get('total_attempted', '?')} correct)\n"
177
  f"Message: {result_data.get('message', 'No message received.')}"
178
  )
179
+ print("Submission successful.\n\n")
180
+ print("Full answer list\n")
181
+ print_answers_dataframe(answers_payload=answers_payload)
182
  results_df = pd.DataFrame(results_log)
183
  return final_status, results_df
184
  except requests.exceptions.HTTPError as e:
 
207
  print(status_message)
208
  results_df = pd.DataFrame(results_log)
209
  return status_message, results_df
210
+
211
 
212
  # --- Build Gradio Interface using Blocks ---
213
  with gr.Blocks() as demo:
requirements.txt CHANGED
@@ -23,4 +23,5 @@ beautifulsoup4
23
  duckduckgo-search==8.0.0
24
  sentencepiece
25
  nltk
26
- SpeechRecognition
 
 
23
  duckduckgo-search==8.0.0
24
  sentencepiece
25
  nltk
26
+ SpeechRecognition
27
+ pandas