Spaces:
Runtime error
Runtime error
Emalbornoz commited on
Commit ·
84e19b6
1
Parent(s): 28bdb5f
Fix: problemas con tensores
Browse files
app.py
CHANGED
|
@@ -58,6 +58,12 @@ async def load_model():
|
|
| 58 |
logger.error(f"Error al cargar el modelo: {str(e)}")
|
| 59 |
raise
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
@app.post("/generate")
|
| 62 |
async def generate_image(
|
| 63 |
prompt: str = Form(..., description="Texto descriptivo para generar la imagen"),
|
|
@@ -115,3 +121,6 @@ async def health_check():
|
|
| 115 |
"""Endpoint para verificar que la API está funcionando"""
|
| 116 |
return {"status": "ok", "model_loaded": pipe is not None}
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
logger.error(f"Error al cargar el modelo: {str(e)}")
|
| 59 |
raise
|
| 60 |
|
| 61 |
+
pipe.unet.to(torch.float32)
|
| 62 |
+
pipe.vae.to(torch.float32)
|
| 63 |
+
pipe.text_encoder.to(torch.float32)
|
| 64 |
+
pipe.text_encoder_2.to(torch.float32)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
@app.post("/generate")
|
| 68 |
async def generate_image(
|
| 69 |
prompt: str = Form(..., description="Texto descriptivo para generar la imagen"),
|
|
|
|
| 121 |
"""Endpoint para verificar que la API está funcionando"""
|
| 122 |
return {"status": "ok", "model_loaded": pipe is not None}
|
| 123 |
|
| 124 |
+
@app.get("/")
|
| 125 |
+
async def root():
|
| 126 |
+
return {"message": "Image Generator API with IP-Adapter is running!", "docs": "/docs"}
|