joshuarauh commited on
Commit
c3922cc
·
verified ·
1 Parent(s): d38e732

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -334,9 +334,8 @@ def extract_and_run_sympy_code(response_text):
334
 
335
  # Import necessary modules
336
  import io
337
- import sys
338
- from contextlib import redirect_stdout
339
  import sympy
 
340
 
341
  # Create a string buffer to capture print output
342
  output_buffer = io.StringIO()
@@ -352,8 +351,8 @@ def extract_and_run_sympy_code(response_text):
352
  with redirect_stdout(output_buffer):
353
  exec(sympy_code, sympy_globals, local_vars)
354
 
355
- # Append the calculated variables
356
- output_buffer.write("SymPy Calculation Results:\n")
357
  output_buffer.write("-" * 25 + "\n")
358
  for var_name, value in local_vars.items():
359
  if not var_name.startswith('__') and not hasattr(value, '__module__'):
 
334
 
335
  # Import necessary modules
336
  import io
 
 
337
  import sympy
338
+ from contextlib import redirect_stdout
339
 
340
  # Create a string buffer to capture print output
341
  output_buffer = io.StringIO()
 
351
  with redirect_stdout(output_buffer):
352
  exec(sympy_code, sympy_globals, local_vars)
353
 
354
+ # Append the calculated variables to the output
355
+ output_buffer.write("\nSymPy Calculation Results:\n")
356
  output_buffer.write("-" * 25 + "\n")
357
  for var_name, value in local_vars.items():
358
  if not var_name.startswith('__') and not hasattr(value, '__module__'):