danieldux commited on
Commit
5abb6ea
1 Parent(s): 18f5f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -1,5 +1,17 @@
1
- import gradio as gr
2
  import os
 
 
 
 
 
 
 
 
 
 
 
3
 
 
 
4
  token = os.getenv("HF_TOKEN")
5
  gr.load("models/ICILS/xlm-r-icils-ilo", hf_token=token).launch()
 
 
1
  import os
2
+ import gradio as gr
3
+ import spaces
4
+ import torch
5
+
6
+ zero = torch.Tensor([0]).cuda()
7
+ print(zero.device) # <-- 'cpu' 🤔
8
+
9
+ @spaces.GPU
10
+ def greet(n):
11
+ print(zero.device) # <-- 'cuda:0' 🤗
12
+ return f"Hello {zero + n} Tensor"
13
 
14
+ # demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
15
+ # demo.launch()
16
  token = os.getenv("HF_TOKEN")
17
  gr.load("models/ICILS/xlm-r-icils-ilo", hf_token=token).launch()