awacke1 commited on
Commit
ac4b0f8
·
1 Parent(s): 4f456f3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import torch
3
+
4
+ def detect_gpu():
5
+ if torch.cuda.is_available():
6
+ device = torch.cuda.get_device_name(0)
7
+ device_memory = torch.cuda.get_device_properties(0).total_memory
8
+ return f"GPU detected: {device}\nMemory: {device_memory} bytes"
9
+ else:
10
+ return "No GPU detected."
11
+
12
+ def main():
13
+ st.title("GPU Detection Demo")
14
+ result = detect_gpu()
15
+ st.write(result)
16
+
17
+ if __name__ == "__main__":
18
+ main()