Spaces:
Sleeping
Sleeping
JasonJwba
commited on
Commit
•
11711c0
1
Parent(s):
fe4704a
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import spaces
|
3 |
-
import torch
|
4 |
|
5 |
-
@spaces.GPU
|
6 |
-
def greet(name):
|
7 |
-
|
8 |
|
9 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
10 |
-
iface.launch()
|
11 |
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
# import spaces
|
3 |
+
# import torch
|
4 |
|
5 |
+
# @spaces.GPU
|
6 |
+
# def greet(name):
|
7 |
+
# return f"Tensor: {torch.Tensor([0]).cuda()}, Name: {name}"
|
8 |
|
9 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
10 |
+
# iface.launch()
|
11 |
|
12 |
+
import spaces
|
13 |
+
from diffusers import DiffusionPipeline
|
14 |
|
15 |
+
pipe = DiffusionPipeline.from_pretrained(...)
|
16 |
+
pipe.to('cuda')
|
17 |
|
18 |
+
@spaces.GPU
|
19 |
+
def generate(prompt):
|
20 |
+
return pipe(prompt).images
|
21 |
|
22 |
+
gr.Interface(
|
23 |
+
fn=generate,
|
24 |
+
inputs=gr.Text(),
|
25 |
+
outputs=gr.Gallery(),
|
26 |
+
).launch()
|