chore: apply formatter and linter to improve code and documentation
Browse files
README.md
CHANGED
|
@@ -12,8 +12,6 @@ license: mit
|
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 14 |
|
| 15 |
-
# Unpredictable Lord
|
| 16 |
-
|
| 17 |
## Development
|
| 18 |
|
| 19 |
### Setup
|
|
|
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 14 |
|
|
|
|
|
|
|
| 15 |
## Development
|
| 16 |
|
| 17 |
### Setup
|
app.py
CHANGED
|
@@ -3,12 +3,14 @@ import spaces
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
zero = torch.Tensor([0]).cuda()
|
| 6 |
-
print(zero.device)
|
|
|
|
| 7 |
|
| 8 |
@spaces.GPU
|
| 9 |
def greet(n):
|
| 10 |
-
print(zero.device)
|
| 11 |
return f"Hello {zero + n} Tensor"
|
| 12 |
|
|
|
|
| 13 |
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
| 14 |
demo.launch()
|
|
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
zero = torch.Tensor([0]).cuda()
|
| 6 |
+
print(zero.device) # <-- 'cpu' 🤔
|
| 7 |
+
|
| 8 |
|
| 9 |
@spaces.GPU
|
| 10 |
def greet(n):
|
| 11 |
+
print(zero.device) # <-- 'cuda:0' 🤗
|
| 12 |
return f"Hello {zero + n} Tensor"
|
| 13 |
|
| 14 |
+
|
| 15 |
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
| 16 |
demo.launch()
|