freemt
commited on
Commit
·
80c38e5
1
Parent(s):
a3d0bb6
Update gradio.Interface examples
Browse files
app.py
CHANGED
@@ -12,6 +12,8 @@ def greet(name):
|
|
12 |
except Exception as e:
|
13 |
out = str(e)
|
14 |
# return "Hello " + name + "!!"
|
|
|
|
|
15 |
return f"[{out}]"
|
16 |
|
17 |
|
@@ -19,6 +21,12 @@ iface = gr.Interface(
|
|
19 |
fn=greet,
|
20 |
inputs="text",
|
21 |
outputs="text",
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
title="probe the system",
|
23 |
description="talk to the system via subprocess.check_output ",
|
24 |
)
|
|
|
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 f"[{out}]"
|
18 |
|
19 |
|
|
|
21 |
fn=greet,
|
22 |
inputs="text",
|
23 |
outputs="text",
|
24 |
+
examples=[
|
25 |
+
"cat /proc/version # show linux distro",
|
26 |
+
"free # show free memory",
|
27 |
+
"uname -m # show machine arch ",
|
28 |
+
"cat /proc/cpuinfo # show cpu info ",
|
29 |
+
],
|
30 |
title="probe the system",
|
31 |
description="talk to the system via subprocess.check_output ",
|
32 |
)
|