Spaces:
Build error
Build error
| import gradio as gr | |
| import sys | |
| def execute_code(code): | |
| try: | |
| exec(code, globals()) | |
| return "Code executed successfully!" | |
| except Exception as e: | |
| return f"Error: {str(e)}" | |
| code_input = gr.Textbox(lines=10, label="Enter Python code") | |
| execute_button = gr.Button() | |
| result_text = gr.Textbox(label="Execution Result") | |
| def execute_code_callback(code): | |
| return execute_code(code) | |
| print("hello") | |
| iface = gr.Interface( | |
| fn=execute_code_callback, | |
| inputs=[code_input, execute_button], | |
| outputs=result_text, | |
| title="Code Executor", | |
| description="Enter your Python code and click 'Execute Code' to run it." | |
| ) | |
| iface.launch(share=True) |