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