Commit ·
53f023a
1
Parent(s): 886ed01
Aplicacion añadida
Browse files- .gitignore +1 -0
- app.py +30 -0
- requirements.txt +5 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
flagged_data_points
|
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
+
from diffusers import DiffusionPipeline
|
| 4 |
+
|
| 5 |
+
modeloGenerarImagen = DiffusionPipeline.from_pretrained("sd-legacy/stable-diffusion-v1-5", torch_dtype=torch.float32)
|
| 6 |
+
|
| 7 |
+
def generarImagen(valorCheckBox, valorRadio, valorDropDown):
|
| 8 |
+
prompt = f'{valorRadio} is {valorDropDown} '
|
| 9 |
+
if(valorCheckBox):
|
| 10 |
+
prompt += " at night"
|
| 11 |
+
else:
|
| 12 |
+
prompt += " in the morning"
|
| 13 |
+
|
| 14 |
+
imagen = modeloGenerarImagen(prompt).images[0]
|
| 15 |
+
return prompt,imagen
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
generarImagen,
|
| 19 |
+
inputs=[
|
| 20 |
+
gr.Checkbox(label="¿De noche?", info="¿el personaje actua de noche?"),
|
| 21 |
+
gr.Radio(["Spideman", "Superman", "Iron Man", "Hulk"], label="Personaje", info="¿Qué personaje quieres?"),
|
| 22 |
+
gr.Dropdown(
|
| 23 |
+
["flying", "jumping", "running"], label="Accion", info="¿Qué esta haciendo?"
|
| 24 |
+
),
|
| 25 |
+
],
|
| 26 |
+
outputs=[
|
| 27 |
+
"text",
|
| 28 |
+
"image"
|
| 29 |
+
])
|
| 30 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
torch==2.6.0
|
| 3 |
+
diffusers==0.32.2
|
| 4 |
+
accelerate==1.5.2
|
| 5 |
+
pydantic==2.12.5
|