Spaces:
Runtime error
Runtime error
Update app.py
Browse files77 unmodified lines787980818283818283844 unmodified lines89909194929394953 unmodified lines9910010110410210310410577 unmodified lines if "python" in resource.lower(): # Remove the 'python' keyword from the code block cleaned_code = re.sub(r'^\s*python', '', resource, flags=re.IGNORECASE | re.MULTILINE) # Add Code Results title with markdown and emoji combined_content += "# Code Results ๐\n" combined_content += "### Code Execution Results ๐\n"
# Redirect standard output to capture it original_stdout = sys.stdout4 unmodified lines exec(cleaned_code, context) code_output = sys.stdout.getvalue() combined_content += f"```\n{code_output}\n```\n\n" realtimeEvalResponse = "# Code Results ๐\n" + "```" + code_output + "```\n\n" realtimeEvalResponse = "### Code Execution Results ๐\n" + "```" + code_output + "```\n\n" st.write(realtimeEvalResponse) except Exception as e:3 unmodified lines sys.stdout = original_stdout else: # Add non-Python resources with markdown and emoji combined_content += "# Resource ๐ ๏ธ\n" + "```" + resource + "```\n\n" combined_content += "### Resource Added For New Tool ๐ ๏ธ\n" + "```" + resource + "```\n\n"
# Save the combined content to a Markdown file if should_save:app.py+3-5