Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,4 +63,15 @@ async def generate(
|
|
| 63 |
return JSONResponse(content={"error": str(e)}, status_code=500)
|
| 64 |
|
| 65 |
# 21. Return the BLIP caption, the constructed prompt, and the generated image URL
|
| 66 |
-
return {"caption": caption, "prompt": prompt, "image_url": image_url}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
return JSONResponse(content={"error": str(e)}, status_code=500)
|
| 64 |
|
| 65 |
# 21. Return the BLIP caption, the constructed prompt, and the generated image URL
|
| 66 |
+
return {"caption": caption, "prompt": prompt, "image_url": image_url}
|
| 67 |
+
|
| 68 |
+
@app.get("/latest")
|
| 69 |
+
def get_latest():
|
| 70 |
+
if last_image_data["image_url"]:
|
| 71 |
+
return last_image_data
|
| 72 |
+
else:
|
| 73 |
+
return {"error": "No image generated yet."}
|
| 74 |
+
|
| 75 |
+
@app.get("/")
|
| 76 |
+
def root():
|
| 77 |
+
return {"status": "ok"}
|