Jimbthebull commited on
Commit
77afa79
·
1 Parent(s): 1332888

git add app.py && git commit -m 'Add application file' && git push (#1)

Browse files

- git add app.py && git commit -m 'Add application file' && git push (a923245afc085002987ea829c39e9d4a24eac9f5)

Files changed (1) hide show
  1. molappy +14 -0
molappy 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()