mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-05-22 09:10:48 +02:00
adjust server
This commit is contained in:
parent
eefa7d53c5
commit
a1ad1147e6
@ -17,9 +17,10 @@ OUTPUT_DIRNAME = "Stable Diffusion UI" # in the user's home folder
|
|||||||
from fastapi import FastAPI, HTTPException
|
from fastapi import FastAPI, HTTPException
|
||||||
from starlette.responses import FileResponse, StreamingResponse
|
from starlette.responses import FileResponse, StreamingResponse
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
import logging
|
|
||||||
# this is needed for development.
|
# this is needed for development.
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
import logging
|
||||||
|
|
||||||
from sd_internal import Request, Response
|
from sd_internal import Request, Response
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
@ -71,7 +72,6 @@ class SetAppConfigRequest(BaseModel):
|
|||||||
@app.get('/')
|
@app.get('/')
|
||||||
def read_root():
|
def read_root():
|
||||||
headers = {"Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache", "Expires": "0"}
|
headers = {"Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache", "Expires": "0"}
|
||||||
#return FileResponse(os.path.join(SD_UI_DIR, 'index.html'), headers=headers)
|
|
||||||
return FileResponse(os.path.join(SD_UI_DIR,'frontend/dist/index.html'), headers=headers)
|
return FileResponse(os.path.join(SD_UI_DIR,'frontend/dist/index.html'), headers=headers)
|
||||||
|
|
||||||
# then get the js files
|
# then get the js files
|
||||||
@ -84,6 +84,7 @@ def read_scripts():
|
|||||||
def read_styles():
|
def read_styles():
|
||||||
return FileResponse(os.path.join(SD_UI_DIR, 'frontend/dist/index.css'))
|
return FileResponse(os.path.join(SD_UI_DIR, 'frontend/dist/index.css'))
|
||||||
|
|
||||||
|
|
||||||
@app.get('/ping')
|
@app.get('/ping')
|
||||||
async def ping():
|
async def ping():
|
||||||
global model_loaded, model_is_loading
|
global model_loaded, model_is_loading
|
||||||
@ -216,7 +217,7 @@ def read_modifiers():
|
|||||||
|
|
||||||
@app.get('/modifiers.json')
|
@app.get('/modifiers.json')
|
||||||
def read_modifiers():
|
def read_modifiers():
|
||||||
return FileResponse(os.path.join(SD_UI_DIR, 'modifiers.json'))
|
return FileResponse(os.path.join(SD_UI_DIR, 'frontend/dist/modifiers.json'))
|
||||||
|
|
||||||
@app.get('/output_dir')
|
@app.get('/output_dir')
|
||||||
def read_home_dir():
|
def read_home_dir():
|
||||||
|
Loading…
Reference in New Issue
Block a user