Javitron4257 commited on
Commit
45d7de9
·
verified ·
1 Parent(s): 14c25aa

Modificamos para usar stable difusion

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,7 +1,10 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  demo.launch()
 
1
  import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+ import torch
4
 
5
+ def stable(prompt):
6
+ pipeline = DiffusionPipeline.from_pretrained("sd-legacy/stable-diffusion-v1-5", torch_dtype=torch.float32)
7
+ return pipeline(prompt).images[0]
8
 
9
+ demo = gr.Interface(fn=stable, inputs="text", outputs="image")
10
  demo.launch()