freemt
commited on
Commit
•
c90742c
1
Parent(s):
419a6a5
Update gradio.Interface examples
Browse files
app.py
CHANGED
@@ -5,16 +5,16 @@ from shlex import split
|
|
5 |
import gradio as gr
|
6 |
|
7 |
|
8 |
-
def greet(
|
9 |
"""Probe vm."""
|
10 |
try:
|
11 |
-
out = sp.check_output(split(
|
12 |
except Exception as e:
|
13 |
out = str(e)
|
14 |
# return "Hello " + name + "!!"
|
15 |
if not (out and out.strip()):
|
16 |
out = "No output, that's all we know."
|
17 |
-
return
|
18 |
|
19 |
|
20 |
iface = gr.Interface(
|
@@ -22,11 +22,11 @@ iface = gr.Interface(
|
|
22 |
inputs="text",
|
23 |
outputs="text",
|
24 |
examples=[
|
25 |
-
"cat /proc/version
|
26 |
"free # show free memory",
|
27 |
-
"uname -m
|
28 |
-
"df -h .
|
29 |
-
"cat /proc/cpuinfo
|
30 |
],
|
31 |
title="probe the system",
|
32 |
description="talk to the system via subprocess.check_output ",
|
|
|
5 |
import gradio as gr
|
6 |
|
7 |
|
8 |
+
def greet(command):
|
9 |
"""Probe vm."""
|
10 |
try:
|
11 |
+
out = sp.check_output(split(command), encoding="utf8")
|
12 |
except Exception as e:
|
13 |
out = str(e)
|
14 |
# return "Hello " + name + "!!"
|
15 |
if not (out and out.strip()):
|
16 |
out = "No output, that's all we know."
|
17 |
+
return out
|
18 |
|
19 |
|
20 |
iface = gr.Interface(
|
|
|
22 |
inputs="text",
|
23 |
outputs="text",
|
24 |
examples=[
|
25 |
+
"cat /proc/version",
|
26 |
"free # show free memory",
|
27 |
+
"uname -m",
|
28 |
+
"df -h .",
|
29 |
+
"cat /proc/cpuinfo",
|
30 |
],
|
31 |
title="probe the system",
|
32 |
description="talk to the system via subprocess.check_output ",
|