Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
iface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
import spaces # Import ZeroGPU helper
|
4 |
|
5 |
+
# Function to check GPU availability
|
6 |
+
@spaces.GPU # This tells Hugging Face to allocate a GPU when this function is called
|
7 |
+
def check_gpu():
|
8 |
+
if torch.cuda.is_available():
|
9 |
+
return "✅ GPU is available! CUDA device: " + torch.cuda.get_device_name(0)
|
10 |
+
else:
|
11 |
+
return "❌ No GPU detected!"
|
12 |
|
13 |
+
# Gradio UI
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=check_gpu, # Call the GPU-checking function
|
16 |
+
inputs=[],
|
17 |
+
outputs="text",
|
18 |
+
)
|
19 |
+
|
20 |
+
iface.launch(share=True, ssr=False)
|