upload2
Browse files
app2.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def greet(name):
|
| 7 |
+
if name == "cpu":
|
| 8 |
+
cpu = os.environ.get("CPU_CORES")
|
| 9 |
+
memory = os.environ.get("MEMORY")
|
| 10 |
+
return f"CPU: {cpu} Memory: {memory}"
|
| 11 |
+
if name == "gpu":
|
| 12 |
+
return os.popen('nvidia-smi').read()
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 16 |
+
iface.launch()
|
| 17 |
+
|