"""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) | |