Spaces:
Sleeping
Sleeping
fahdmirzac
commited on
Commit
β’
c6e3cc1
1
Parent(s):
2fd7f3d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
|