Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
Movign to latest og, and full transfer to httpx.
  • Loading branch information
ItsCEED committed Jun 26, 2023
1 parent 7c1005f commit 96e4b13
Show file tree
Hide file tree
Showing 10 changed files with 976 additions and 530 deletions.
18 changes: 12 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
from imaginepy import Imagine, Style, Ratio
from imaginepy import Imagine
from imaginepy.constants import *


def main():
imagine = Imagine(style=Style.ANIME_V2) #initialize with style
imagine = Imagine()

img_data = imagine.sdprem(
prompt="Woman sitting on a table, looking at the sky, seen from behind",
style=Style.ANIME_V2,
ratio=Ratio.RATIO_16X9
style=Style.NO_STYLE,
ratio=Ratio.RATIO_16X9,
negative="",
seed=1000,
cfg=16,
model=Model.REALISTIC,
asbase64=False # default is false, putting it here as presentation.
)

if img_data is None:
print("An error occurred while generating the image.")
return

img_data = imagine.upscale(image=img_data)
img_data = imagine.upscale(img_data)

if img_data is None:
print("An error occurred while upscaling the image.")
return

try:
with open("example.png", mode="wb") as img_file:
with open("example.jpeg", mode="wb") as img_file:
img_file.write(img_data)
except Exception as e:
print(f"An error occurred while writing the image to file: {e}")
Expand Down
20 changes: 12 additions & 8 deletions app_async.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import asyncio
from imaginepy import AsyncImagine, Style, Ratio
from imaginepy import AsyncImagine
from imaginepy.constants import *


async def main():
imagine = AsyncImagine(style=Style.ANIME_V2) #initialize with style

img_data = await imagine.sdprem(
imagine = AsyncImagine()
img_data = imagine.sdprem(
prompt="Woman sitting on a table, looking at the sky, seen from behind",
style=Style.ANIME_V2,
ratio=Ratio.RATIO_16X9
style=Style.NO_STYLE,
ratio=Ratio.RATIO_16X9,
negative="",
seed=1000,
cfg=16,
model=Model.REALISTIC,
asbase64=False # default is false, putting it here as presentation.
)

if img_data is None:
Expand All @@ -26,9 +31,8 @@ async def main():
img_file.write(img_data)
except Exception as e:
print(f"An error occurred while writing the image to file: {e}")

await imagine.close()



if __name__ == "__main__":
Expand Down
Binary file modified example.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions imaginepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .sync_imagine import Imagine
from .async_imagine import AsyncImagine
from .sync_imagine import Imagine, DeviantArt
from .async_imagine import AsyncImagine, DeviantArt
from .constants import *

__version__ = "1.1.0"
__version__ = "2.0.0"
Loading

0 comments on commit 96e4b13

Please sign in to comment.