JasonJwba commited on
Commit
11711c0
1 Parent(s): fe4704a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
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
- 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()
 
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()