Spaces:
Sleeping
Sleeping
File size: 618 Bytes
c2d4056 a2c05a5 c2d4056 a2c05a5 c2d4056 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import gradio as gr
import spaces
import torch
import gdown
import os
import setup_environment
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' π€
@spaces.GPU
def greet(n):
print(zero.device) # <-- 'cuda:0' π€
# λ€μ΄λ‘λν νμΌμ 곡μ λ§ν¬
#file_id = 'your_file_id_here'
file_id=os.getenv('ZIPFILE_ID')
url = f"https://drive.google.com/uc?id={file_id}"
# νμΌ λ€μ΄λ‘λ
gdown.download(url, '/tmp/', quiet=False)
return f"Hello {zero + n} Tensor"
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
demo.launch()
|