fix: add routes to match stablestudio routes

pull/340/head
Bryce 1 year ago committed by Bryce Drennan
parent edafcc5529
commit 8ffb0fac0e

@ -491,6 +491,10 @@ A: The AI models are cached in `~/.cache/` (or `HUGGINGFACE_HUB_CACHE`). To dele
## ChangeLog
- feature: show full stack trace when there is an api error
- fix: make lack of support for python 3.11 explicit
- fix: add some routes to match StableStudio routes
**13.0.0**
- 🎉 feature: multi-controlnet support. pass in multiple `--control-mode`, `--control-image`, and `--control-image-raw` arguments.
- 🎉 feature: add colorization controlnet. improve `aimg colorize` command

@ -7,7 +7,7 @@ from asyncio import Lock
from fastapi import FastAPI, Query, Request
from fastapi.concurrency import run_in_threadpool
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse, StreamingResponse
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
from fastapi.staticfiles import StaticFiles
from imaginairy.http.models import ImagineWebPrompt
@ -16,6 +16,9 @@ from imaginairy.http.utils import generate_image
logger = logging.getLogger(__name__)
static_folder = os.path.dirname(os.path.abspath(__file__)) + "/stablestudio/dist"
gpu_lock = Lock()
@ -50,8 +53,15 @@ async def imagine_get_endpoint(text: str = Query(...)):
return StreamingResponse(img_io, media_type="image/jpg")
static_folder = os.path.dirname(os.path.abspath(__file__)) + "/stablestudio/dist"
print(f"static_folder: {static_folder}")
@app.get("/edit")
async def edit_redir():
return FileResponse(f"{static_folder}/index.html")
@app.get("/generate")
async def generate_redir():
return FileResponse(f"{static_folder}/index.html")
app.mount("/", StaticFiles(directory=static_folder, html=True), name="static")

Loading…
Cancel
Save