Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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()
|