Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
a80a131
1
Parent(s):
5133bfc
lfg
Browse files
scripts/format_response.py
CHANGED
|
@@ -659,6 +659,12 @@ def execute_code_from_markdown(code_str, datasets=None):
|
|
| 659 |
# Clear captured outputs for each block
|
| 660 |
captured_outputs.clear()
|
| 661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 662 |
with stdoutIO() as s:
|
| 663 |
exec(block_code, context) # Execute the block
|
| 664 |
|
|
|
|
| 659 |
# Clear captured outputs for each block
|
| 660 |
captured_outputs.clear()
|
| 661 |
|
| 662 |
+
# Fix indentation issues before execution
|
| 663 |
+
try:
|
| 664 |
+
block_code = textwrap.dedent(block_code)
|
| 665 |
+
except Exception as dedent_error:
|
| 666 |
+
logger.log_message(f"Failed to dedent code block '{block_name}': {str(dedent_error)}", level=logging.WARNING)
|
| 667 |
+
|
| 668 |
with stdoutIO() as s:
|
| 669 |
exec(block_code, context) # Execute the block
|
| 670 |
|