Spaces:
Runtime error
Runtime error
Commit
·
093ea09
1
Parent(s):
5893f63
Update test.py
Browse filescheck envrion and GPU
test.py
CHANGED
@@ -2,18 +2,20 @@ import streamlit as st
|
|
2 |
import subprocess
|
3 |
import torch
|
4 |
|
5 |
-
st.title("Hugging Face Space GPU Info")
|
6 |
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
if
|
11 |
-
|
12 |
-
st.write(f"GPU available: {gpu_name}")
|
13 |
-
else:
|
14 |
-
st.write("No GPU available")
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import subprocess
|
3 |
import torch
|
4 |
|
|
|
5 |
|
6 |
+
def app():
|
7 |
+
st.title("Hugging Face Space GPU Info")
|
8 |
|
9 |
+
# Check if GPU is available
|
10 |
+
gpu_available = torch.cuda.is_available()
|
|
|
|
|
|
|
11 |
|
12 |
+
if gpu_available:
|
13 |
+
gpu_name = torch.cuda.get_device_name(0)
|
14 |
+
st.write(f"GPU available: {gpu_name}")
|
15 |
+
else:
|
16 |
+
st.write("No GPU available")
|
17 |
+
|
18 |
+
# Ping the server
|
19 |
+
st.title("Server Ping")
|
20 |
+
ping_output = subprocess.check_output(["ping", "-c", "4", "google.com"])
|
21 |
+
st.write("Ping output:\n", ping_output.decode("utf-8"))
|