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