Spaces:
Runtime error
Runtime error
Update app.py
Browse files77 unmodified lines7879808182838485864 unmodified lines919293949596973 unmodified lines10110210310410510610777 unmodified linesif "python" in resource.lower():# Remove the 'python' keyword from the code blockcleaned_code = re.sub(r'^\s*python', '', resource, flags=re.IGNORECASE | re.MULTILINE)# Add Code Results title with markdown and emojicombined_content += "# Code Results ๐\n"# Redirect standard output to capture itoriginal_stdout = sys.stdout4 unmodified linesexec(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"st.write(realtimeEvalResponse)except Exception as e:3 unmodified linessys.stdout = original_stdoutelse:# Add non-Python resources with markdown and emojicombined_content += "# Resource ๐ ๏ธ\n" + "```" + resource + "```\n\n"# Save the combined content to a Markdown fileif should_save:77 unmodified lines787980818283844 unmodified lines899091929394953 unmodified lines9910010110210310410577 unmodified linesif "python" in resource.lower():# Remove the 'python' keyword from the code blockcleaned_code = re.sub(r'^\s*python', '', resource, flags=re.IGNORECASE | re.MULTILINE)combined_content += "### Code Execution Results ๐\n"# Redirect standard output to capture itoriginal_stdout = sys.stdout4 unmodified linesexec(cleaned_code, context)code_output = sys.stdout.getvalue()combined_content += f"```\n{code_output}\n```\n\n"realtimeEvalResponse = "### Code Execution Results ๐\n" + "```" + code_output + "```\n\n"st.write(realtimeEvalResponse)except Exception as e:3 unmodified linessys.stdout = original_stdoutelse:# Add non-Python resources with markdown and emojicombined_content += "### Resource Added For New Tool ๐ ๏ธ\n" + "```" + resource + "```\n\n"# Save the combined content to a Markdown fileif should_save:
app.py+3-5