Spaces:
Sleeping
Sleeping
a0y0346 Cursor commited on
Commit ·
620fbe1
1
Parent(s): c7a094b
add dummy app.py to verify ZeroGPU setup
Browse filesBasic Gradio app with @spaces.GPU decorator to confirm
GPU allocation works on HuggingFace Spaces.
Co-authored-by: Cursor <cursoragent@cursor.com>
- .gitignore +34 -0
- app.py +14 -0
.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Environment variables and secrets
|
| 2 |
+
.env
|
| 3 |
+
.env.*
|
| 4 |
+
|
| 5 |
+
# Python
|
| 6 |
+
__pycache__/
|
| 7 |
+
*.py[cod]
|
| 8 |
+
*$py.class
|
| 9 |
+
*.so
|
| 10 |
+
.Python
|
| 11 |
+
*.egg-info/
|
| 12 |
+
*.egg
|
| 13 |
+
dist/
|
| 14 |
+
build/
|
| 15 |
+
.eggs/
|
| 16 |
+
|
| 17 |
+
# Virtual environments
|
| 18 |
+
venv/
|
| 19 |
+
.venv/
|
| 20 |
+
env/
|
| 21 |
+
|
| 22 |
+
# IDE
|
| 23 |
+
.vscode/
|
| 24 |
+
.idea/
|
| 25 |
+
*.swp
|
| 26 |
+
*.swo
|
| 27 |
+
*~
|
| 28 |
+
|
| 29 |
+
# OS
|
| 30 |
+
.DS_Store
|
| 31 |
+
Thumbs.db
|
| 32 |
+
|
| 33 |
+
# HuggingFace cache
|
| 34 |
+
.cache/
|
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
zero = torch.Tensor([0]).cuda()
|
| 6 |
+
print(zero.device) # <-- 'cpu' 🤔
|
| 7 |
+
|
| 8 |
+
@spaces.GPU
|
| 9 |
+
def greet(n):
|
| 10 |
+
print(zero.device) # <-- 'cuda:0' 🤗
|
| 11 |
+
return f"Hello {zero + n} Tensor"
|
| 12 |
+
|
| 13 |
+
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
| 14 |
+
demo.launch()
|