Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,27 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#import gradio as gr
|
2 |
+
#gr.Interface.load("models/goofyai/3d_render_style_xl").launch()
|
3 |
import gradio as gr
|
4 |
+
from diffusers import DiffusionPipeline
|
5 |
+
from PIL import Image
|
6 |
|
7 |
+
# Cargar el modelo y los pesos
|
8 |
+
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
|
9 |
+
pipeline.load_lora_weights("goofyai/3d_render_style_xl")
|
10 |
+
|
11 |
+
# Función para generar imágenes a partir de texto
|
12 |
+
def generate_image(input_text):
|
13 |
+
result = pipeline.generate(input_text)
|
14 |
+
image = Image.fromarray(result)
|
15 |
+
return image
|
16 |
+
|
17 |
+
# Crear una interfaz de Gradio
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=generate_image,
|
20 |
+
inputs="text",
|
21 |
+
outputs="image",
|
22 |
+
title="Texto a Imagen",
|
23 |
+
description="Genera imágenes a partir de texto.",
|
24 |
+
)
|
25 |
+
|
26 |
+
# Ejecutar la interfaz
|
27 |
+
iface.launch()
|