homer-meng commited on
Commit
093ea09
·
1 Parent(s): 5893f63

Update test.py

Browse files

check envrion and GPU

Files changed (1) hide show
  1. test.py +14 -12
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
- # 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"))
 
 
 
 
 
 
 
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"))