File size: 591 Bytes
08bc52f c015fd4 c33b262 7faa9af c33b262 08bc52f c015fd4 7faa9af c015fd4 7faa9af c33b262 7faa9af 0bf7d6b 0c951fa 0bf7d6b |
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 28 |
"""Talk to spaces VM via subprocess.check_output."""
# import httpx
import subprocess as sp
from shlex import split
import gradio as gr
def greet(name):
"""Probe vm."""
try:
out = sp.check_output(split(name), encoding="utf8")
except Exception as e:
out = str(e)
# return "Hello " + name + "!!"
return f"[{out}]"
iface = gr.Interface(
fn=greet,
inputs="text",
outputs="text",
title="probe the system",
description="talk to the system via subprocess.check_output ",
)
# iface.launch(share=True, debug=True)
iface.launch(debug=True)
|