yangfan
commited on
Commit
·
a9e3801
1
Parent(s):
6bce1f7
feat(*): change evn
Browse files- app.py +14 -3
- packages.txt +0 -0
- requirements.txt +2 -0
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
demo.launch()
|
|
|
|
|
|
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="text", outputs="text")
|
14 |
+
|
15 |
+
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
16 |
demo.launch()
|
17 |
+
|
18 |
+
|
packages.txt
ADDED
File without changes
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
scikit-learn
|