Spaces:
Running
Running
File size: 679 Bytes
d4fa759 96bcc4a d4fa759 96bcc4a d4fa759 96bcc4a 0ddab14 d4fa759 96bcc4a d4fa759 96bcc4a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import subprocess
import gradio as gr
def infer(command):
try:
return subprocess.check_output(
command,
shell=True,
stderr=subprocess.STDOUT,
text=True,
)
except subprocess.CalledProcessError as e:
return f"Error: {e.output}"
if __name__ == "__main__":
gr.Interface(
fn=infer,
inputs=gr.Textbox(label="Linux Command", value="ls"),
outputs=gr.TextArea(label="Command Output", show_copy_button=True),
title="Linux Command Executor",
description="Enter a Linux command and click submit to see the output.",
flagging_mode="never",
).launch()
|