Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 74dbd5e

Browse files
committed
Fixed folder errors
1 parent 2cdfeeb commit 74dbd5e

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

opengpt/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ def Print(context: Text, warn: Optional[bool] = False) -> None:
2020
class OpenGPT:
2121
@classmethod
2222
def __init__(self: type, provider: Text, type: Optional[Text] = "completion", options: Optional[Union[Dict[Text, Text], None]] = None) -> None:
23-
24-
self.__DIR: Text = os.getcwd()
23+
self.__DIR: Text = os.path.dirname(os.path.abspath(__file__))
2524
self.__LoadModels()
2625
self.__TYPE: Text = type
2726
self.__OPTIONS: Union[Dict[Text, Text], None] = options
2827
self.__PROVIDER: Text = provider
29-
3028
self.__Verifications()
3129
self.__MODULE: module = importlib.import_module(f"opengpt.models.{self.__TYPE}.{self.__PROVIDER}.model")
3230
self.__MODEL_CLASS: type = getattr(self.__MODULE, "Model")
33-
3431
self.__model: type = None
3532
self.__InitializeModelClass()
3633

@@ -58,7 +55,7 @@ def __InitializeModelClass(self: type) -> None:
5855

5956
@classmethod
6057
def __LoadModels(self: type) -> None:
61-
self.__DATA: Dict[Text, Text] = yaml.safe_load(open(self.__DIR + "/config.yml").read())
58+
self.__DATA: Dict[Text, Text] = yaml.safe_load(open(self.__DIR + "/config.yml", "r").read())
6259

6360
@classmethod
6461
def __Verifications(self: type) -> None:

opengpt/models/image/hotpot/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class Model:
2323
@classmethod
2424
def __init__(self: type, style: Optional[Text] = "Hotpot Art 9") -> None:
2525
self._SETUP_LOGGER()
26+
self.__DIR: Text = os.path.dirname(os.path.abspath(__file__))
2627
self.__LoadStyles()
27-
self.__DIR: Text = os.getcwd()
2828
self.__session: requests.Session = requests.Session()
2929
self.__UNIQUE_ID: str = UniqueID(16)
3030
self.STYLE: Text = style
@@ -73,7 +73,7 @@ def UpdateStyle(self: type, style: Text) -> None:
7373

7474
@classmethod
7575
def __LoadStyles(self: type) -> None:
76-
self.__DATA: Dict[Text, Text] = yaml.safe_load(open(self.__DIR + "/styles.yml").read())
76+
self.__DATA: Dict[Text, Text] = yaml.safe_load(open(self.__DIR + "/styles.yml", "r").read())
7777

7878
@classmethod
7979
def __Fields(self: type, *args: Tuple[int, str], **kwargs: Dict[str, Any]) -> Text:

tests/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from opengpt import OpenGPT
22

3-
hotpot = OpenGPT(provider="hotpot", type="image", options={"style": "Acrylic Art"})
4-
print(hotpot.Generate("Man with Black T-Shirt").url)
3+
hotpot = OpenGPT(provider="hotpot", type="image", options={"style": "Portrait Anime 1"})
4+
print(hotpot.Generate("Man with Red T-Shirt and Blue Light Hair").url)

0 commit comments

Comments
 (0)