Spaces:
Running
Running
Accept string
Browse files- generate.py +6 -2
generate.py
CHANGED
|
@@ -26,12 +26,16 @@ def extract_code(completion: str) -> str:
|
|
| 26 |
if code_block:
|
| 27 |
return code_block.group(1)
|
| 28 |
|
| 29 |
-
def get_solution_file_path(model: str, day: Optional[int] = None):
|
| 30 |
"""Returns the path to the solution file for the given day and model. If day is None, returns the path to the solution file only."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
if day is None:
|
| 32 |
return f"solution_{model}.py"
|
| 33 |
|
| 34 |
-
day_str = f"{day:02d}"
|
| 35 |
return f"day{day_str}/solution_{model}.py"
|
| 36 |
|
| 37 |
|
|
|
|
| 26 |
if code_block:
|
| 27 |
return code_block.group(1)
|
| 28 |
|
| 29 |
+
def get_solution_file_path(model: str, day: Optional[str | int] = None):
|
| 30 |
"""Returns the path to the solution file for the given day and model. If day is None, returns the path to the solution file only."""
|
| 31 |
+
|
| 32 |
+
if isinstance(day, str):
|
| 33 |
+
day = int(day)
|
| 34 |
+
day_str = f"{day:02d}"
|
| 35 |
+
|
| 36 |
if day is None:
|
| 37 |
return f"solution_{model}.py"
|
| 38 |
|
|
|
|
| 39 |
return f"day{day_str}/solution_{model}.py"
|
| 40 |
|
| 41 |
|