import gradio as gr import torch import spaces # Import ZeroGPU helper # Function to check GPU availability @spaces.GPU # This tells Hugging Face to allocate a GPU when this function is called def check_gpu(): if torch.cuda.is_available(): return "✅ GPU is available! CUDA device: " + torch.cuda.get_device_name(0) else: return "❌ No GPU detected!" # Gradio UI iface = gr.Interface( fn=check_gpu, # Call the GPU-checking function inputs=[], outputs="text", ) iface.launch()