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()