Ramesh-vani's picture
Update app.py
3fcc68b
raw
history blame
651 Bytes
import gradio
import subprocess
def run_command(command):
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = process.communicate()
if process.returncode == 0:
result = output.decode('utf-8')
return result
else:
result = error.decode('utf-8')
return result
gradio_interface = gradio.Interface(
fn=run_command,
inputs="text",
outputs="text",
examples=[
["ls -l"],
["pip install bs4"]
],
title="REST API ",
description="This is an AI powered REST API ",
article=""
)
gradio_interface.launch()