import gradio as gr import subprocess def run_bash_command(command): try: result = subprocess.run(command, shell=True, capture_output=True, text=True) output = result.stdout if result.stdout else result.stderr return output except Exception as e: return str(e) interface = gr.Interface( fn=run_bash_command, inputs="text", outputs="text", title="Terminal Emulator", description="Enter bash commands and see the output." ) interface.launch()