Spaces:
Sleeping
Sleeping
epochs-demos
commited on
Commit
•
4c14f94
1
Parent(s):
c51964a
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -25,6 +25,14 @@ def check_solution(instructor_code, student_code, function_name, test_cases):
|
|
25 |
|
26 |
if not callable(instructor_function):
|
27 |
raise ValueError(f"{instructor_function} is not a callable function.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Run the tests and populate the results table
|
30 |
expected_result_list = []
|
|
|
25 |
|
26 |
if not callable(instructor_function):
|
27 |
raise ValueError(f"{instructor_function} is not a callable function.")
|
28 |
+
|
29 |
+
# Execute student's code
|
30 |
+
globals_dict = {}
|
31 |
+
exec(student_code, globals_dict)
|
32 |
+
student_function = globals_dict.get(function_name)
|
33 |
+
|
34 |
+
if not callable(student_function):
|
35 |
+
raise ValueError(f"{function_name} is not a callable function.")
|
36 |
|
37 |
# Run the tests and populate the results table
|
38 |
expected_result_list = []
|