Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from diffusers import StableDiffusionPipeline
|
| 3 |
+
|
| 4 |
+
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
|
| 5 |
+
pipe = pipe.to("cpu")
|
| 6 |
+
|
| 7 |
+
def generar_imagen(prompt):
|
| 8 |
+
imagen = pipe(prompt).images[0]
|
| 9 |
+
return imagen
|
| 10 |
+
|
| 11 |
+
interfaz = gr.Interface(
|
| 12 |
+
fn=generar_imagen,
|
| 13 |
+
inputs=gr.Textbox(label="Escribe tu idea"),
|
| 14 |
+
outputs=gr.Image(label="Imagen generada")
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
interfaz.launch()
|