소스 검색

use os.getcwd() instead

jtydhr88 1 년 전
부모
커밋
7286c876fd
1개의 변경된 파일2개의 추가작업 그리고 11개의 파일을 삭제
  1. 2 11
      scripts/api.py

+ 2 - 11
scripts/api.py

@@ -12,15 +12,6 @@ import base64
 from pydantic import BaseModel
 from pydantic import BaseModel
 
 
 
 
-def get_root_path():
-    path = os.path.dirname(os.path.realpath(__file__))
-    path = os.path.dirname(path)
-    path = os.path.dirname(path)
-    path = os.path.dirname(path)
-
-    return path
-
-
 class GetGeneratedImagesRequest(BaseModel):
 class GetGeneratedImagesRequest(BaseModel):
     limit: int = 10
     limit: int = 10
 
 
@@ -28,7 +19,7 @@ class GetGeneratedImagesRequest(BaseModel):
 def StableStudio_api(_: gr.Blocks, app: FastAPI):
 def StableStudio_api(_: gr.Blocks, app: FastAPI):
     @app.get("/StableStudio/check-extension-installed")
     @app.get("/StableStudio/check-extension-installed")
     async def check_extension_installed(extension_name: str):
     async def check_extension_installed(extension_name: str):
-        extension_path = os.path.join(get_root_path(), "extensions", extension_name)
+        extension_path = os.path.join(os.getcwd(), "extensions", extension_name)
 
 
         installed = 0
         installed = 0
 
 
@@ -42,7 +33,7 @@ def StableStudio_api(_: gr.Blocks, app: FastAPI):
 
 
     @app.post("/StableStudio/get-generated-images")
     @app.post("/StableStudio/get-generated-images")
     async def get_generated_images(request: GetGeneratedImagesRequest):
     async def get_generated_images(request: GetGeneratedImagesRequest):
-        outputs_path = os.path.join(get_root_path(), "outputs")
+        outputs_path = os.path.join(os.getcwd(), "outputs")
 
 
         txt2img_folder = os.path.join(outputs_path, 'txt2img-images', '**')
         txt2img_folder = os.path.join(outputs_path, 'txt2img-images', '**')
         img2img_folder = os.path.join(outputs_path, 'img2img-images', '**')
         img2img_folder = os.path.join(outputs_path, 'img2img-images', '**')