Skip to content

Commit

Permalink
fix extention arg
Browse files Browse the repository at this point in the history
fix extension arg

fi
  • Loading branch information
dr413677671 committed Aug 5, 2023
1 parent 89b20a5 commit ef9aabc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions paste_this_to_webui_scripts_folder/prompt_gallery.py
Expand Up @@ -17,7 +17,7 @@
import io
from PIL import Image
import mimetypes

from modules.paths_internal import extensions_dir
mimetypes.init()
mimetypes.add_type('application/javascript', '.js')

Expand All @@ -35,16 +35,16 @@
else:
root_path = os.path.abspath(shared.script_path)

rela_path = os.path.join( 'extensions')
rela_path = os.path.join('extensions')

try:
with open( os.path.join( rela_path, 'prompt_gallery_name.json') ) as fd:
with open(os.path.join(extensions_dir, 'prompt_gallery_name.json')) as fd:
extension_name = json.load(fd)['name']
except:
extension_name = "Prompt Gallery"

OUTPATH_SAMPLES = os.path.join(rela_path, extension_name, 'assets', 'preview')
OUTPATH_GRIDS = os.path.join(rela_path, extension_name, 'assets', 'grid')
OUTPATH_SAMPLES = os.path.join(extensions_dir, extension_name, 'assets', 'preview')
OUTPATH_GRIDS = os.path.join(extensions_dir, extension_name, 'assets', 'grid')

BATCH_SIZE = 2
N_ITER = 2
Expand Down
5 changes: 3 additions & 2 deletions scripts/prompt_gallery.py
Expand Up @@ -7,6 +7,7 @@
import modules.ui
from modules.shared import opts, cmd_opts
from modules import shared, scripts
from modules.paths_internal import extensions_dir
from modules import script_callbacks
from pathlib import Path
from typing import List, Tuple
Expand All @@ -31,11 +32,11 @@
def on_ui_settings():
global pg_ip

with open("./extensions/prompt_gallery_name.json") as fd:
with open(os.path.join(extensions_dir, 'prompt_gallery_name.json')) as fd:
name = json.load(fd)['name']
# os.chmod('./extensions/'+name, stat.S_IRWXO)
app = FastAPI()
app.mount('/', StaticFiles(directory='./extensions/'+name,html=True))
app.mount('/', StaticFiles(directory=extensions_dir+"/"+name,html=True))
config = Config(app=app, host=pg_ip,port=pg_port, log_level="info", loop="asyncio", limit_max_requests=1)
app.add_middleware(
CORSMiddleware,
Expand Down

0 comments on commit ef9aabc

Please sign in to comment.